Open tisonkun opened 5 months ago
By default, the extractor will return a 400 Bad Request when an error occurs, but sometimes you may want to change this behavior, so you can handle the error yourself.
In the following example, when the Query extractor fails, it will return a 500 Internal Server response and the reason for the error.
Seems like we can use a Result<[Extractor]>
extractor?
Description of the feature
This code snippet:
would be expanded to:
I know I can change the return type of my function to customize error in my handling logic, but what if I'd like to decorate the error message when fail to
<Json<Query> as poem::FromRequest>::from_request(&req, &mut body).await?
?.Code example (if possible)
By default, it may return:
while I'd prefer to customize the error message, like: