aboutsummaryrefslogtreecommitdiff
path: root/server/src/ui/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/ui/error.rs')
-rw-r--r--server/src/ui/error.rs37
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),
}
}
}