-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support custom handling of extractor errors #181
Comments
you can use this method https://actix.rs/actix-web/actix_web/error/struct.InternalError.html#method.from_response |
Wow, quick update, thanks! I will give it a try 😄 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Example:
Currently, if there is a deserialization error when attempting to extract an
Item
(e.g. because the JSON payload has missing fields, or is the wrong type) an empty HTTP 400 Bad Request response will be returned due to the impl ofResponseError for DeError
.Whilst this is sufficient for experimental or internal APIs, it would be useful to be able to customise or override how errors are handled. For myself, I wanted to include the text of the serialization error in the response body so consumers can debug their bad requests.
The text was updated successfully, but these errors were encountered: