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
Maybe this should be done different, but I would assume that I can additionally to modify the status_code of the HandlerError also add body data.
My use-case would be e.g.: parsing JSON data from the request and if there is a syntax error return the error message from serde(as body) with an UNPROCESSABLE_ENTITY status code.
The text was updated successfully, but these errors were encountered:
It is not possible to attach any data except for the status code to a HandlerError. I don't believe that a HandlerError should be upgraded to full response creation abilities (this was suggested before, e.g. in #529). However, it might make sense to include the error message (since every Error implements Display anyways) in the created error response. It sounds like that would cover your use case.
Thanks, reading through #529 gave me a better picture on the design choice of gotham here.
I guess I have to create a more flexible way for error returns anyway, so I'll probably not use HandlerError for that, it would be just nice to use ? in most situations without wrapping the error in a normal response.
Maybe this should be done different, but I would assume that I can additionally to modify the status_code of the
HandlerError
also add body data.My use-case would be e.g.: parsing JSON data from the request and if there is a syntax error return the error message from serde(as body) with an UNPROCESSABLE_ENTITY status code.
The text was updated successfully, but these errors were encountered: