mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-09-13 21:22:42 +00:00
add api_not_found catcher for 404 errors in /api
This commit is contained in:
parent
acb5ab08a8
commit
102ee3f871
3 changed files with 18 additions and 0 deletions
|
@ -38,6 +38,7 @@ pub fn routes() -> Vec<Route> {
|
|||
// Move this somewhere else
|
||||
//
|
||||
use rocket::serde::json::Json;
|
||||
use rocket::Catcher;
|
||||
use rocket::Route;
|
||||
use serde_json::Value;
|
||||
|
||||
|
@ -221,3 +222,18 @@ fn config() -> Json<Value> {
|
|||
},
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn catchers() -> Vec<Catcher> {
|
||||
catchers![api_not_found]
|
||||
}
|
||||
|
||||
#[catch(404)]
|
||||
fn api_not_found() -> Json<Value> {
|
||||
Json(json!({
|
||||
"error": {
|
||||
"code": 404,
|
||||
"reason": "Not Found",
|
||||
"description": "The requested resource could not be found."
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue