From ef1ad1723470d9de4c4957db9cf644f717edca23 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Fri, 8 Jan 2021 21:11:20 -0800 Subject: [PATCH] Unknown path error handling --- src/main.rs | 2 +- src/user.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9d6acc7..64f6e98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ async fn main() -> std::io::Result<()> { // TRAILING SLASH MIDDLEWARE .wrap(NormalizePath::default()) // DEFAULT SERVICE - .default_service(web::get().to(utils::error)) + .default_service(web::get().to(|| utils::error("Nothing here".to_string()))) // GENERAL SERVICES .route("/style.css/", web::get().to(style)) .route("/favicon.ico/", web::get().to(HttpResponse::Ok)) diff --git a/src/user.rs b/src/user.rs index cfac229..c7552ce 100644 --- a/src/user.rs +++ b/src/user.rs @@ -42,7 +42,7 @@ pub async fn profile(req: HttpRequest) -> HttpResponse { HttpResponse::Ok().content_type("text/html").body(s) } // If there is an error show error page - Err(msg) => {dbg!(msg);error(msg.to_string()).await}, + Err(msg) => error(msg.to_string()).await, } }