Skip to content

Add custom exception hierarchy for error handling#230

Closed
gjmulhol wants to merge 1 commit intomainfrom
error-handling/exception-hierarchy
Closed

Add custom exception hierarchy for error handling#230
gjmulhol wants to merge 1 commit intomainfrom
error-handling/exception-hierarchy

Conversation

@gjmulhol
Copy link
Copy Markdown

Summary

  • Introduce GemdError base class and specific subclasses (GemdValueError, GemdTypeError, GemdBoundsError, GemdValidationError, GemdEnumerationError, GemdSerializationError, GemdKeyError, unit error wrappers)
  • All custom exceptions inherit from both a gemd base and the corresponding Python built-in type (e.g., GemdValueError(GemdError, ValueError)) for backward compatibility
  • Exceptions store structured data as attributes (expected, received, context, guidance) for programmatic introspection
  • Bump version to 2.2.2

Test plan

  • 9 new tests in tests/test_exceptions.py covering hierarchy, backward compat, structured attributes
  • Full test suite passes (242 passed, 1 xfailed)
  • Lint passes

This is PR 1 of a series to improve error handling across gemd-python. Subsequent PRs will convert existing raise statements to use these new exception types with verbose, actionable messages.

🤖 Generated with Claude Code

Introduce GemdError base class and specific subclasses (GemdValueError,
GemdTypeError, GemdBoundsError, etc.) that inherit from both the gemd
base and the corresponding Python built-in types for backward
compatibility. Bump version to 2.2.2.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@gjmulhol
Copy link
Copy Markdown
Author

Superseded by unified branch

@gjmulhol gjmulhol closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant