Log not found URI.

This commit is contained in:
2026-10-25 16:06:42 +01:00
parent 455096fa37
commit bfacd2e302
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -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,
+1 -1
View File
@@ -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)
}
+1
View File
@@ -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(),