summaryrefslogtreecommitdiff
path: root/src/routes/errors.rs
diff options
context:
space:
mode:
authorDaniel Hader <[email protected]>2026-05-20 22:04:16 -0500
committerDaniel Hader <[email protected]>2026-05-20 22:04:16 -0500
commit92436c8bb9eafcc56219e784f8b374edfb1907a3 (patch)
tree45c9ebc50220414c20700e653cb17dd0c21ec00f /src/routes/errors.rs
parent74bc939843ae5c35fbd367c1ef0144b6074cfefe (diff)
basic login route with JWT
Diffstat (limited to 'src/routes/errors.rs')
-rw-r--r--src/routes/errors.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/routes/errors.rs b/src/routes/errors.rs
index 6261d75..78b4e3a 100644
--- a/src/routes/errors.rs
+++ b/src/routes/errors.rs
@@ -5,6 +5,8 @@ pub enum RouteError {
Internal(String),
UserCreateEmailExists(String),
UserCreateUsernameExists(String),
+ UnregisteredEmail(String),
+ AuthorizationFailure(),
}
impl IntoResponse for RouteError {
@@ -18,6 +20,12 @@ impl IntoResponse for RouteError {
},
RouteError::UserCreateUsernameExists(username) => {
(StatusCode::BAD_REQUEST, format!("user with username \"{}\" already exists", username))
+ },
+ RouteError::UnregisteredEmail(email) => {
+ (StatusCode::BAD_REQUEST, format!("email \"{}\" is not registered", email))
+ },
+ RouteError::AuthorizationFailure() => {
+ (StatusCode::UNAUTHORIZED, format!("failed to authorize"))
}
};