Break root module docs into separate files (#432)

For 0.3 I'm thinking about some changes I wanna make to the docs. I
don't like how information is currently spread over so many places.
Still thinking about how I wanna re-organize it.

However I do think it makes sense to break the root module docs into
separate files that get included with `#![doc = include_str!("file")]`.
Makes working on a single section easier and more focused. It looks the
same for the user reading the docs.

This means axum's MSRV is now 1.54 but since thats two releases ago I'm
fine with that.
This commit is contained in:
David Pedersen
2021-10-31 20:37:56 +01:00
committed by GitHub
parent 9145c0e396
commit 857ecd7314
17 changed files with 1170 additions and 1169 deletions
+19
View File
@@ -0,0 +1,19 @@
# Error handling
In the context of axum an "error" specifically means if a [`Service`]'s
response future resolves to `Err(Service::Error)`. That means async handler
functions can _never_ fail since they always produce a response and their
`Service::Error` type is [`Infallible`]. Returning statuses like 404 or 500
are _not_ errors.
axum works this way because hyper will close the connection, without sending
a response, if an error is encountered. This is not desireable so axum makes
it impossible to forget to handle errors.
Sometimes you need to route to fallible services or apply fallible
middleware in which case you need to handle the errors. That can be done
using things from [`error_handling`].
You can find examples here:
- [Routing to fallible services](#routing-to-fallible-services)
- [Applying fallible middleware](#applying-multiple-middleware)