You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To send a custom message for Pydantic errors, we require the error type. Pydantic's error details are lost while building the error message in SignatureModel._build_error_message. If we add the exc dict to this message, it will be propagated to exception handlers
Summary
To send a custom message for Pydantic errors, we require the error
type
. Pydantic's error details are lost while building the error message inSignatureModel._build_error_message
. If we add theexc
dict to this message, it will be propagated to exception handlersBasic Example
Then in an exception handler, Pydantic's error dict can be accessed by:
validation_exception["extra"][0]["exc"]
Drawbacks and Impact
No response
Unresolved questions
Is there a better way to propagate Pydantic's error object to
ValidationException
received by the handlers?Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: