-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch pydantic validation errors with one validation type #2
Comments
ASDF's error is a direct use of jsonschema's which is not a subclass of a standard type from jsonschema import ValidationError Pydantic's error is a subclass of TypeError from pydantic.error_wrappers import ValidationError I really would love to use ExceptionGroup (new in Python 3.11) for this because there are situations where I want to catch only pydantic validation error. |
Maybe Conversely, since this is such a new library you could just require Python 3.11 to use it. |
Desired result: from asdf import ValidationError
try:
af.open(...)
except ValidationError:
... After Python 3.11, from asdf import ValidationError
# Very verbose, could forward this asdf_pydantic
from pydantic.error_wrappers import ValidationError as PydanticValidationError
try:
af.open(...)
except* ValidationError:
...
except* PydanticValidationError:
... |
Good idea on inheriting
I will consider it; I have things in Roman that are 3.10. |
The text was updated successfully, but these errors were encountered: