From bfacd2e302a36ce51020913a917ae8ee48587d80 Mon Sep 17 00:00:00 2001 From: Rogier Reerink Date: Sun, 25 Oct 2026 16:06:42 +0100 Subject: [PATCH] Log not found URI. --- server/src/error.rs | 5 +++++ server/src/routes.rs | 2 +- server/src/routes/errors.rs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/error.rs b/server/src/error.rs index cc5a525..62a6d94 100644 --- a/server/src/error.rs +++ b/server/src/error.rs @@ -1,3 +1,5 @@ +use axum::http::Uri; + use crate::{domain::DomainError, repository::RepositoryError, routes::extractors::ExtractorError}; #[derive(Debug, thiserror::Error)] @@ -29,6 +31,9 @@ pub enum AppError { #[error("not found")] NotFound, + #[error("not found: {0}")] + NotFoundWithUri(Uri), + #[error("race condition occurred")] RaceCondition, diff --git a/server/src/routes.rs b/server/src/routes.rs index 8172fe7..387e9aa 100644 --- a/server/src/routes.rs +++ b/server/src/routes.rs @@ -39,6 +39,6 @@ pub fn create_router(state: AppState) -> axum::Router { axum::Router::new() .nest("/api", api) .route("/health", get(async || StatusCode::NO_CONTENT)) - .fallback(async || AppError::NotFound) + .fallback(async |uri: axum::http::Uri| AppError::NotFoundWithUri(uri)) .with_state(state) } diff --git a/server/src/routes/errors.rs b/server/src/routes/errors.rs index 7e89fc4..de7ff17 100644 --- a/server/src/routes/errors.rs +++ b/server/src/routes/errors.rs @@ -51,6 +51,7 @@ impl ClientError for AppError { Self::InvalidRefreshToken => (StatusCode::UNAUTHORIZED, "Invalid refresh token".into()), Self::RaceCondition => (StatusCode::CONFLICT, "Try again".into()), Self::NotFound => (StatusCode::NOT_FOUND, "Not found".into()), + Self::NotFoundWithUri(_) => (StatusCode::NOT_FOUND, "Not found".into()), Self::Domain(error) => error.client_response(), Self::Extractor(error) => error.client_response(), Self::Repository(error) => error.client_response(),