partially solve #68

This commit is contained in:
Didier Link 2018-06-21 11:58:54 +02:00
parent a4d248e351
commit 2d1a035877
1 changed files with 11 additions and 4 deletions

View File

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