diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-12 20:32:51 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-04-12 20:32:51 -0500 |
commit | bdafb04ae1db57412c8f9fa8afb1e5627c60cb16 (patch) | |
tree | 32cc1eca385e0d983afc1d6b7fe2665216e6bbf6 /src/api/error.rs | |
parent | 00d63f5a5648f76d8e9cb8597446e05901543a0c (diff) |
refactor: clean up fallback routes and routers
Diffstat (limited to 'src/api/error.rs')
-rw-r--r-- | src/api/error.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/api/error.rs b/src/api/error.rs index f5d4291..bd43ce3 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -3,6 +3,9 @@ pub enum Error { #[error("Database error: {0}")] Sqlx(#[from] sqlx::Error), + #[error("Route not found: {0}")] + RouteNotFound(axum::http::Uri), + #[error("User not found")] UserNotFound, @@ -27,7 +30,7 @@ impl axum::response::IntoResponse for Error { use axum::http::StatusCode; let status = match self { - Self::UserNotFound => StatusCode::NOT_FOUND, + Self::RouteNotFound(_) | Self::UserNotFound => StatusCode::NOT_FOUND, Self::EmailExists => StatusCode::CONFLICT, Self::EmailInvalid(_) => StatusCode::UNPROCESSABLE_ENTITY, Self::InvalidToken => StatusCode::UNAUTHORIZED, |