From 394d4b14f6fa03a3ec80039d9d0e736eae6a514b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 2 Nov 2021 18:02:09 +0100 Subject: [PATCH] Mention handling extractor failures in error handling docs --- src/docs/error_handling.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/docs/error_handling.md b/src/docs/error_handling.md index a87532a1..7c9c3572 100644 --- a/src/docs/error_handling.md +++ b/src/docs/error_handling.md @@ -31,6 +31,11 @@ It doesn't matter whether you return `Err(StatusCode::NOT_FOUND)` or `Err(StatusCode::INTERNAL_SERVER_ERROR)`. These are not considered errors in axum. +This also applies to extractors. If an extractor doesn't match the request the +request will be rejected and a response will be returned without calling your +handler. See [`extract`](crate::extract) to learn more about handling extractor +failures. + # Routing to fallible services You generally don't have to think about errors if you're only using async