How to return the error of FromForm
to the client?
#2553
Unanswered
duskmoon314
asked this question in
Questions
Replies: 1 comment 1 reply
-
I don't totally understand the question, especially this part:
But maybe what you're looking for is the Alternatively, if you just want all of the errors, ask for a #[post("/", data = "<form>")]
fn f(data: Result<Form<T>, form::Errors<'_>>) { .. } |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR: I want to return the validation result of
FromForm
to the client instead of a 404 message. How can I achieve this?Details
I'm trying to build a handler at
get("/path?<format>)
. It can receive several formats and deny other inputs. Thus, I define a struct like this:This works well, except it prints
expected one of ...
to stdout but returns the message to the client. How should I fix this problem?Beta Was this translation helpful? Give feedback.
All reactions