Skip to main content

attempt

Function attempt 

Source
pub async fn attempt<T: IntoResponse>(
    body: impl Future<Output = Result<T, Errors>>,
) -> Response
Expand description

Run a handler body that uses ?, turning a validation failure into its 422 response instead of letting it escape as a server error.

See the crate documentation for why this exists rather than an IntoResponse implementation on Result<_, Errors>.