-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow to get the original error message inside a catch registered via catchers!() #1234
Comments
I also ran into this and am currently working around it in each route handler by accepting a |
Above solution is correct, see #953 (comment) Sadly this does not work for errors occurring in RequestGuards, where you can only define a custom Status and no body whatsoever (unless you define a status for every error that can occur and map it in a catcher to an standard status code with your static custom body) |
See my response at #1232 (comment), which largely applies here as well. In particular:
That is unexpected - in rocket 0.4 |
Any updates on where this enhancement stands now that the |
That's unfortunate. If I remember right the issue was that we don't want to bound all impl FromRequest for Type {
type Error = ...;
fn upcast_error(e: Self::Error) -> Option<Box<dyn Any + Send>> { Box::new(e) as Box<dyn Any + Send> }
fn from_request(request: &Request) -> Result<Self, Self::Error> { ... }
} This is nothing more than a vague idea at this point, but I'll think on it more when we take the issue up. |
Let's track this in #749. |
Hi.
Consider the following route:
and the following registered catcher:
When we send a JSON missing some field, it raises an:
however, it would be nice to show something like this instead:
but the catcher should be something like, i.e. some new Rocket feature:
Notice my custom error type
DbError
in the route, it contains an ownResponder
, btw it is never called, because it seems Rocket handles the error internally and refuse my responder. =/TIA for any help!
The text was updated successfully, but these errors were encountered: