Replies: 2 comments
-
Request guards cannot respond directly to a request. They can signal an error outcome, and a handler can catch that by using
It's very odd to use Rocket's error type as the error value in your request guard. No documentation should have led you to that. You should let the types guide you. Or the examples. Please read our documentation here: https://api.rocket.rs/v0.5/rocket/request/trait.FromRequest.html#example-1 |
Beta Was this translation helpful? Give feedback.
-
Thanks, I hadn't realized that I could use |
Beta Was this translation helpful? Give feedback.
-
I'm implementing
FromRequest
on mySearchParams
struct, but I'm having trouble with thefrom_request
parser I'm writing.I want to return some kind of error json with an appropriate status code and a message. Something like:
I can't figure out how to work with
Outcome::Error
and I keep finding older documentation aboutOutcome::Failure
that looks closer to what I'm wanting to do. How do I do this?Beta Was this translation helpful? Give feedback.
All reactions