Merged
Conversation
tmathern
commented
Jan 7, 2026
|
|
||
| class C2paError(Exception): | ||
| """Exception raised for C2PA errors.""" | ||
| """Exception raised for C2PA errors. |
Collaborator
Author
There was a problem hiding this comment.
Fixing error class hierarchy to leverage typed errors better, especially in the new Reader factory method
tmathern
commented
Jan 7, 2026
| self.message = message | ||
| super().__init__(message) | ||
|
|
||
| class Assertion(Exception): |
Collaborator
Author
There was a problem hiding this comment.
Specific exceptions (all the types nested in the parent class) got un-nested from here so they can inherit from the base C2pa exception and get the C2paException type.
tmathern
commented
Jan 7, 2026
| # Attach exception subclasses to C2paError for backward compatibility | ||
| # Preserves behavior for exception catching like except C2paError.ManifestNotFound, | ||
| # also reduces imports (think of it as an alias of sorts) | ||
| C2paError.Assertion = _C2paAssertion |
Collaborator
Author
There was a problem hiding this comment.
An we still can use the parent type for general error catching!
3 tasks
gpeacock
approved these changes
Jan 7, 2026
| if ': ' in error_str: | ||
| parts = error_str.split(': ', 1) | ||
| else: | ||
| parts = error_str.split(' ', 1) |
Contributor
There was a problem hiding this comment.
If the c api is inconsistent here, we should add an issue to fix it so that we always use the colon
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.
Changes in this pull request
Checklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.