Update ructe to 0.14.0.

This commit is contained in:
Rasmus Kaj 2022-02-06 19:51:54 +01:00
parent c4c3d92af8
commit f27ed9b78e
2 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -114,19 +114,19 @@ pub async fn run(args: &Args) -> Result<(), Error> {
async fn customize_error(err: Rejection) -> Result<Response, Rejection> {
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<Response, Rejection> {
}
fn error_response(err: StatusCode) -> Result<Response, Rejection> {
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.