partially solve #68

This commit is contained in:
Didier Link 2018-06-21 11:58:54 +02:00
parent a4d248e351
commit 2d1a035877

View File

@ -1,15 +1,22 @@
use rocket_contrib::Template; use rocket_contrib::Template;
use rocket::Request;
use rocket::request::FromRequest;
use models::users::User;
#[catch(404)] #[catch(404)]
fn not_found() -> Template { fn not_found(req: &Request) -> Template {
let user = User::from_request(req).succeeded();
Template::render("errors/404", json!({ Template::render("errors/404", json!({
"error_message": "Page not found" "error_message": "Page not found",
"account": user
})) }))
} }
#[catch(500)] #[catch(500)]
fn server_error() -> Template { fn server_error(req: &Request) -> Template {
let user = User::from_request(req).succeeded();
Template::render("errors/500", json!({ Template::render("errors/500", json!({
"error_message": "Server error" "error_message": "Server error",
"account": user
})) }))
} }