From f5f103404857fb4f21cf71ac72fd5aa88baed95a Mon Sep 17 00:00:00 2001 From: gennyble Date: Sun, 23 Feb 2025 02:17:04 -0600 Subject: Log 404s as warnings --- TODO | 7 ++++++- src/main.rs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 6aae58a..caba2e8 100644 --- a/TODO +++ b/TODO @@ -39,4 +39,9 @@ about specifically, will allow it to be drawn over the larger one so it will let us see most of both fo them. This is working now with TX/RX because we do more TX than RX, but that could - change and I would rather have it switch with smartness. \ No newline at end of file + change and I would rather have it switch with smartness. + +(7) Stick 404's in the database + Mostly because I think it would be funny to see all the weird + endpoints the crawlers hit, and a bit to know what links I've + killed over the course of time. \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c036324..b2ac1e9 100755 --- a/src/main.rs +++ b/src/main.rs @@ -147,6 +147,13 @@ async fn handler( ) -> Response { match falible_handler(state, fs, settings, sid, rfr, path).await { Ok(resp) => resp, + Err(RuntimeError::NotFound { source: _, path }) => { + tracing::warn!("[{sid}] 404 on {path}"); + + Response::builder() + .body(Body::from(format!("the path was not found: {path}"))) + .unwrap() + } Err(re) => Response::builder() .body(Body::from(re.to_string())) .unwrap(), -- cgit 1.4.1-3-g733a5