diff --git a/crates/oxidetalis/src/database/user.rs b/crates/oxidetalis/src/database/user.rs index 3230aa3..4cc27a0 100644 --- a/crates/oxidetalis/src/database/user.rs +++ b/crates/oxidetalis/src/database/user.rs @@ -53,7 +53,7 @@ impl UserTableExt for DatabaseConnection { .await { if let Some(SqlErr::UniqueConstraintViolation(_)) = err.sql_err() { - return Err(ApiError::DuplicatedUser); + return Err(ApiError::AlreadyRegistered); } } diff --git a/crates/oxidetalis/src/errors.rs b/crates/oxidetalis/src/errors.rs index 95f6b2f..325cfc3 100644 --- a/crates/oxidetalis/src/errors.rs +++ b/crates/oxidetalis/src/errors.rs @@ -48,7 +48,7 @@ pub enum ApiError { RegistrationClosed, /// The entered public key is already registered (400 Bad Request) #[error("The entered public key is already registered")] - DuplicatedUser, + AlreadyRegistered, /// The user entered two different public keys /// one in the header and other in the request body /// (400 Bad Request) @@ -62,7 +62,7 @@ impl ApiError { match self { Self::SeaOrm(_) => StatusCode::INTERNAL_SERVER_ERROR, Self::RegistrationClosed => StatusCode::FORBIDDEN, - Self::DuplicatedUser | Self::TwoDifferentKeys => StatusCode::BAD_REQUEST, + Self::AlreadyRegistered | Self::TwoDifferentKeys => StatusCode::BAD_REQUEST, } } }