diff options
-rw-r--r-- | kittybox-rs/Cargo.toml | 2 | ||||
-rw-r--r-- | kittybox-rs/src/main.rs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/kittybox-rs/Cargo.toml b/kittybox-rs/Cargo.toml index 5a3ae90..1d1d9fd 100644 --- a/kittybox-rs/Cargo.toml +++ b/kittybox-rs/Cargo.toml @@ -72,7 +72,7 @@ sha2 = "^0.9.8" # SHA-2 series of algorithms for Rust tracing = { version = "0.1.34", features = [] } tracing-tree = "0.2.1" tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] } -tower-http = { version = "0.3.3", features = ["trace", "cors"] } +tower-http = { version = "0.3.3", features = ["trace", "cors", "catch-panic"] } tower = { version = "0.4.12", features = ["tracing"] } tracing-log = "0.1.3" [dependencies.tokio] diff --git a/kittybox-rs/src/main.rs b/kittybox-rs/src/main.rs index 59c3e69..4fb0eec 100644 --- a/kittybox-rs/src/main.rs +++ b/kittybox-rs/src/main.rs @@ -174,8 +174,8 @@ async fn main() { "/.kittybox/health", axum::routing::get( |axum::Extension(db): axum::Extension<FileStorage>| async move { - // TODO health-check the database - "OK" + // TODO health-check the database + "OK" } ) .layer(axum::Extension(database)) @@ -195,7 +195,8 @@ async fn main() { .layer(axum::Extension(kittybox::tokenauth::TokenEndpoint(token_endpoint))) .layer(tower::ServiceBuilder::new() .layer(tower_http::trace::TraceLayer::new_for_http()) - .into_inner()); + .into_inner()) + .layer(tower_http::catch_panic::CatchPanicLayer::new()); // A little dance to turn a potential file descriptor into // a guaranteed async network socket |