1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use self::super::super::errors::{GenericErrorSeverity, GenericError};
use rocket_contrib::Json;
lazy_static! {
pub static ref RESPONSE_404: GenericError = GenericError {
reason: "endpoint does not exist".into(),
severity: GenericErrorSeverity::Warning,
};
pub static ref RESPONSE_500: GenericError = GenericError {
reason: "critical internal server error".into(),
severity: GenericErrorSeverity::Danger,
};
}
#[catch(404)]
pub fn not_found() -> Json<&'static GenericError> {
Json(&*RESPONSE_404)
}
#[catch(500)]
pub fn internal_server_error() -> Json<&'static GenericError> {
Json(&*RESPONSE_500)
}