Add OumiConfigParsingError covering all OmegaConf exceptions#2323
Open
idoudali wants to merge 2 commits intoidoudali/config-exceptionsfrom
Open
Conversation
…rror handling Introduce dedicated config exception types and add explicit configuration checks to catch invalid or missing values early. Wire these failures into the CLI global handler so users get clearer, consistent error messages. Improve current file checks during configuration parsing. Fixes OPE-1848
Introduce OumiConfigParsingError to wrap all OmegaConfBaseException subclasses (ValidationError, GrammarParseError, ConfigIndexError, etc.) so that every OmegaConf exception raised in our configs submodule is reported as a clean user-facing error by the CLI instead of dumping a full traceback. Fixes OPE-1852
a306a1f to
6cc8433
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated OumiConfigParsingError to wrap OmegaConf parsing/validation exceptions so CLI/config loading surfaces clean, user-facing configuration errors (via OumiConfigError) rather than raw OmegaConf tracebacks.
Changes:
- Added
OumiConfigParsingError(andOumiConfigTypeError) to the central exception hierarchy insrc/oumi/exceptions.py. - Updated
BaseConfig.from_yaml(),from_str(), andfrom_yaml_and_arg_list()to catchOmegaConfBaseExceptionand re-raise asOumiConfigParsingErrorwith proper__cause__chaining; replaced ad-hocTypeErrorwithOumiConfigTypeError. - Updated/added unit tests to assert the new wrapper exception behavior and cause chaining (including a malformed interpolation case).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/unit/core/configs/test_config.py |
Updates expectations to OumiConfigParsingError and asserts underlying OmegaConf cause is chained. |
tests/unit/core/configs/test_base_config.py |
Adds coverage for wrapped parsing errors (unknown field + malformed interpolation) and reuses a shared YAML fixture string. |
src/oumi/exceptions.py |
Adds OumiConfigParsingError (and OumiConfigTypeError) to support consistent, user-friendly config error handling. |
src/oumi/core/configs/base_config.py |
Wraps OmegaConf exceptions during YAML/string load and CLI arg merges into OumiConfigParsingError, and standardizes type mismatch errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e46d02e to
4804801
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduce OumiConfigParsingError to wrap all OmegaConfBaseException subclasses (ValidationError, GrammarParseError, ConfigIndexError, etc.) so that every OmegaConf exception is reported as a clean user-facing error by the CLI instead of dumping a full traceback.
Fixes OPE-1852
Related issues
Fixes # (issue)
Before submitting
Reviewers
At least one review from a member of
oumi-ai/oumi-staffis required.