Feature/explicit exception type #47

Merged
HideyoshiNakazone merged 6 commits from feature/explicit-exception-type into main 2025-09-14 04:13:28 +00:00
HideyoshiNakazone commented 2025-09-14 00:12:48 +00:00 (Migrated from github.com)

This pull request refactors how schema validation errors are handled throughout the codebase by introducing two custom exception classes: InvalidSchemaException and UnsupportedSchemaException. These new exceptions replace generic ValueError and TypeError usages, providing more descriptive error messages and additional context about the source of the error.

Exception Handling Improvements

  • Added new exception classes InvalidSchemaException and UnsupportedSchemaException in the jambo/exceptions package, with support for contextual information such as the problematic field and underlying cause. (jambo/exceptions/invalid_schema_exception.py, jambo/exceptions/unsupported_schema_exception.py, jambo/exceptions/__init__.py) [1] [2] [3]

Types Package Improvements

  • Added explicit exports for schema-related types in jambo/types/__init__.py to improve type import clarity and consistency.

Testing Adjustments

  • Updated tests to expect the correct exception type after refactoring, ensuring test coverage matches new error handling behavior. (tests/test_schema_converter.py)
This pull request refactors how schema validation errors are handled throughout the codebase by introducing two custom exception classes: `InvalidSchemaException` and `UnsupportedSchemaException`. These new exceptions replace generic `ValueError` and `TypeError` usages, providing more descriptive error messages and additional context about the source of the error. **Exception Handling Improvements** * Added new exception classes `InvalidSchemaException` and `UnsupportedSchemaException` in the `jambo/exceptions` package, with support for contextual information such as the problematic field and underlying cause. (`jambo/exceptions/invalid_schema_exception.py`, `jambo/exceptions/unsupported_schema_exception.py`, `jambo/exceptions/__init__.py`) [[1]](diffhunk://#diff-6ec6c5d9e30588c96b30834f0383e8d86d522bc2ea2594088ce989f375da32b4R1-R27) [[2]](diffhunk://#diff-5d8cc71f15674ea8498c619d53e62589f87d453f5f2de20e9ddec02859eba647R1-R23) [[3]](diffhunk://#diff-f4c3661f91fe26fa6fb26e84fb22dcfa3769d68dcb46047a5299bf05a2916a53R1-R5) **Types Package Improvements** * Added explicit exports for schema-related types in `jambo/types/__init__.py` to improve type import clarity and consistency. **Testing Adjustments** * Updated tests to expect the correct exception type after refactoring, ensuring test coverage matches new error handling behavior. (`tests/test_schema_converter.py`)
codecov[bot] commented 2025-09-14 03:11:28 +00:00 (Migrated from github.com)

Codecov Report

All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

## [Codecov](https://app.codecov.io/gh/HideyoshiNakazone/jambo/pull/47?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vitor+Hideyoshi) Report :white_check_mark: All modified and coverable lines are covered by tests. :loudspeaker: Thoughts on this report? [Let us know!](https://github.com/codecov/feedback/issues/255)
Sign in to join this conversation.