Skip to content

refactor: add InvalidExecutionModeError for unknown execution modes#38

Merged
guru-desh merged 4 commits into
apple:mainfrom
guru-desh:add-invalid-execution-error
Jul 17, 2026
Merged

refactor: add InvalidExecutionModeError for unknown execution modes#38
guru-desh merged 4 commits into
apple:mainfrom
guru-desh:add-invalid-execution-error

Conversation

@guru-desh

Copy link
Copy Markdown
Contributor

There are repeated ValueErrors with similar messaging for raising exceptions for invalid execution modes (if neither graph nor eager is specified). This PR consolidates it into a custom exception so we don't repeat ourselves

Define InvalidExecutionModeError(ValueError) next to the ExecutionMode
enum so callers can catch a single, dedicated exception type instead
of matching on ad-hoc ValueError message strings.
Add the new exception to the public quantization package surface
alongside ExecutionMode.
Replace the duplicated ValueError messages in Quantizer and
ModelInspector with the shared InvalidExecutionModeError.
…_raises

Match the new exception type instead of the old ValueError message.
Comment thread src/coreai_opt/quantization/config/__init__.py
@guru-desh guru-desh added the enhancement New feature or request label Jul 14, 2026
@guru-desh
guru-desh marked this pull request as ready for review July 14, 2026 20:05
@guru-desh
guru-desh force-pushed the add-invalid-execution-error branch from c56af19 to 9b51292 Compare July 14, 2026 23:08

@crowbat crowbat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InvalidExecutionModeError changes themselves seem fine to me, approving

@guru-desh
guru-desh merged commit 2965864 into apple:main Jul 17, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants