-
I'm seeing 422 Unprocessable Content being returned from my web app. I don't have anything in my code that generates that status, and I can't find anything in the Rocket docs about it either. Is there any way to find out why this status is being returned, e.g. some additional info the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
As far as I know this is returned when one of the guards fail. Could you share a code snippet? |
Beta Was this translation helpful? Give feedback.
-
hi @fenhl , from experience Rocket returns 422 when it's unable to match an incoming request to a known handler. may be having a closer look at the logs (near the start where Rocket lists all configured routes, ctachers, etc...) can shed more light on why your handler is not being picked. also suggest you have a closer look at the grammar of what is taken into account when defining a route. as stated there, a route is determined by more than just an HTTP verb and path. finally, if you still cannot see the problem, may be catching the error (see catchers in the guide) and doing some logging can give more info. |
Beta Was this translation helpful? Give feedback.
Here's the endpoint that's failing: https://github.com/midoshouse/midos.house/blob/dee453cf71600a6ce74e4aeb50b7ccf383e40d12/src/user.rs#L293-L294
The errors are happening on the path
/user/jimbo
, so it's someone misunderstanding how profile pages work (my user IDs are numerical), but according to theFromParam
docs, this should return 404, not 422:So maybe this is a bug in Rocket?