From 86f9b6fbb3d1c24a4ae45f933f16b38db9fa1d34 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Sun, 15 Sep 2024 21:43:56 -0400 Subject: [PATCH] Convert Infaliable Result into Option and handle --- src/fileserv.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fileserv.rs b/src/fileserv.rs index b9bebf8..4fe7a30 100644 --- a/src/fileserv.rs +++ b/src/fileserv.rs @@ -29,11 +29,11 @@ cfg_if! { if #[cfg(feature = "ssr")] { let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap(); // `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot` // This path is relative to the cargo root - match ServeDir::new(root).oneshot(req).await { - Ok(res) => Ok(res.into_response()), - Err(err) => Err(( + match ServeDir::new(root).oneshot(req).await.ok() { + Some(res) => Ok(res.into_response()), + None => Err(( StatusCode::INTERNAL_SERVER_ERROR, - format!("Something went wrong: {err}"), + format!("Something went wrong"), )), } }