From f27ed9b78ea3f9223847abfac71ca1260306aea2 Mon Sep 17 00:00:00 2001 From: Rasmus Kaj Date: Sun, 6 Feb 2022 19:51:54 +0100 Subject: [PATCH] Update ructe to 0.14.0. --- Cargo.toml | 2 +- src/server/mod.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8595fa0..6de3464 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" build = "src/build.rs" [build-dependencies] -ructe = { version = "0.13.4", features = ["sass", "warp03"] } +ructe = { version = "0.14.0", features = ["sass", "warp03"] } [dependencies] brotli = "3.3.0" diff --git a/src/server/mod.rs b/src/server/mod.rs index 19c886e..e4fb531 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -114,19 +114,19 @@ pub async fn run(args: &Args) -> Result<(), Error> { async fn customize_error(err: Rejection) -> Result { if err.is_not_found() { log::info!("Got a 404: {:?}", err); - Builder::new().status(StatusCode::NOT_FOUND).html(|o| { + Ok(Builder::new().status(StatusCode::NOT_FOUND).html(|o| { templates::error( o, StatusCode::NOT_FOUND, "The resource you requested could not be located.", ) - }) + })?) } else { let code = StatusCode::INTERNAL_SERVER_ERROR; // FIXME log::error!("Got a {}: {:?}", code.as_u16(), err); - Builder::new() + Ok(Builder::new() .status(code) - .html(|o| templates::error(o, code, "Something went wrong.")) + .html(|o| templates::error(o, code, "Something went wrong."))?) } } @@ -157,9 +157,9 @@ fn permission_denied() -> Result { } fn error_response(err: StatusCode) -> Result { - Builder::new() + Ok(Builder::new() .status(err) - .html(|o| templates::error(o, err, "Sorry about this.")) + .html(|o| templates::error(o, err, "Sorry about this."))?) } /// Handler for static files.