Skip to content

Commit f7d5f24

Browse files
committed
Replace rocket's default 404 with one that doesn't log ERROR.
1 parent 063ae70 commit f7d5f24

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/server.rs

+7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@ pub fn serve() {
1515
routes![api::all_fcps, api::member_fcps, api::github_webhook],
1616
)
1717
.mount("/", routes![html::all_fcps, html::member_fcps])
18+
.register(catchers![not_found])
1819
.launch();
1920
});
2021

2122
ok_or!(result, why => error!("Rocket failed to ignite: {:?}", why));
2223
}
2324
}
2425

26+
#[catch(404)]
27+
fn not_found(req: &rocket::Request<'_>) -> String {
28+
info!("No matching routes for {} {}", req.method(), req.uri());
29+
format!("`{}` is not a valid path.", req.uri())
30+
}
31+
2532
mod html {
2633
use super::TEMPLATES;
2734
use crate::error::DashResult;

0 commit comments

Comments
 (0)