mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02:00
Revamp error handling model (#402)
* Revamp error handling model * changelog improvements and typo fixes * Fix a few more Infallible bounds * minor docs fixes
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! ```
|
||||
|
||||
use axum::{
|
||||
error_handling::HandleErrorExt,
|
||||
extract::TypedHeader,
|
||||
handler::get,
|
||||
http::StatusCode,
|
||||
@@ -28,10 +29,10 @@ async fn main() {
|
||||
ServeDir::new("examples/sse/assets").append_index_html_on_directories(true),
|
||||
)
|
||||
.handle_error(|error: std::io::Error| {
|
||||
Ok::<_, std::convert::Infallible>((
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Unhandled internal error: {}", error),
|
||||
))
|
||||
)
|
||||
});
|
||||
|
||||
// build our application with a route
|
||||
|
||||
Reference in New Issue
Block a user