diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-29 11:10:21 +0200 |
commit | f62c7f2a8cc143454779dc99334ca9fc80ddabd5 (patch) | |
tree | f31dbb908715d2deb2860e2097fa13dd41d759d5 /server/src/ui/error.rs | |
parent | 73d2d5eb01fceae9e0b1c58afb648822000c878a (diff) | |
download | jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.bz2 jellything-f62c7f2a8cc143454779dc99334ca9fc80ddabd5.tar.zst |
still just moving code around
Diffstat (limited to 'server/src/ui/error.rs')
-rw-r--r-- | server/src/ui/error.rs | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/server/src/ui/error.rs b/server/src/ui/error.rs index 6ba2ba9..0ea1a8d 100644 --- a/server/src/ui/error.rs +++ b/server/src/ui/error.rs @@ -8,7 +8,7 @@ use log::info; use rocket::{ catch, http::{ContentType, Status}, - response::{self, Responder}, + response::{self, content::RawHtml, Responder}, Request, }; use serde_json::{json, Value}; @@ -24,18 +24,19 @@ static ERROR_IMAGE: LazyLock<Vec<u8>> = LazyLock::new(|| { }); #[catch(default)] -pub fn r_catch<'a>(status: Status, _request: &Request) -> DynLayoutPage<'a> { - LayoutPage { - title: "Not found".to_string(), - content: markup::new! { - h2 { "Error" } - p { @format!("{status}") } - @if status == Status::NotFound { - p { "You might need to " a[href=uri!(r_account_login())] { "log in" } ", to see this page" } - } - }, - ..Default::default() - } +pub fn r_catch<'a>(status: Status, _request: &Request) -> RawHtml<String> { + // LayoutPage { + // title: "Not found".to_string(), + // content: markup::new! { + // h2 { "Error" } + // p { @format!("{status}") } + // @if status == Status::NotFound { + // p { "You might need to " a[href=uri!(r_account_login())] { "log in" } ", to see this page" } + // } + // }, + // ..Default::default() + // } + RawHtml("as".to_string()) } #[catch(default)] @@ -56,15 +57,7 @@ impl<'r> Responder<'r, 'static> for MyError { Some(x) if x.is_avif() || x.is_png() || x.is_jpeg() => { (ContentType::AVIF, ERROR_IMAGE.as_slice()).respond_to(req) } - _ => LayoutPage { - title: "Error".to_string(), - content: markup::new! { - h2 { "An error occured. Nobody is sorry"} - pre.error { @format!("{:?}", self.0) } - }, - ..Default::default() - } - .respond_to(req), + _ => r_catch(Status::InternalServerError, req).respond_to(req), } } } |