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
Given a route like the one below that takes a Json request body:
#[post("/", format = "json", data = "<data>")]fn my_route(data:Json<MyData>) -> ...
If the user submits an invalid request body to an endpoint like the one listed below it returns a generic 422 error page. I'd like to return some more useful information, such as the text of the serde deserialization error to give the user a hint as to what is wrong with their request. I looked at catchers guide to see if there's a way to get at the error generated processing the request but can't figure out how to do this.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Returning useful error message back to client when request data can't be deserialized?
Returning useful error message back to client when request JSON data can't be deserialized?
Jul 22, 2020
Rocket version: 0.4.5
Given a route like the one below that takes a Json request body:
If the user submits an invalid request body to an endpoint like the one listed below it returns a generic 422 error page. I'd like to return some more useful information, such as the text of the serde deserialization error to give the user a hint as to what is wrong with their request. I looked at catchers guide to see if there's a way to get at the error generated processing the request but can't figure out how to do this.
The text was updated successfully, but these errors were encountered: