Add generic error catchers
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
use rocket_contrib::Template;
|
||||
|
||||
#[catch(404)]
|
||||
fn not_found() -> Template {
|
||||
Template::render("errors/404", json!({
|
||||
"error_message": "Page not found"
|
||||
}))
|
||||
}
|
||||
|
||||
#[catch(500)]
|
||||
fn server_error() -> Template {
|
||||
Template::render("errors/500", json!({
|
||||
"error_message": "Server error"
|
||||
}))
|
||||
}
|
||||
@@ -3,6 +3,7 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
pub mod blogs;
|
||||
pub mod comments;
|
||||
pub mod errors;
|
||||
pub mod instance;
|
||||
pub mod likes;
|
||||
pub mod notifications;
|
||||
|
||||
Reference in New Issue
Block a user