mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-19 06:21:15 +00:00
fix: code cleanup
This commit is contained in:
parent
53a0dc9f2c
commit
23562f492c
1 changed files with 2 additions and 22 deletions
|
|
@ -21,15 +21,11 @@ pub enum ServiceError {
|
|||
#[error("Parrent not found")]
|
||||
ParentNotFound,
|
||||
#[error("Database error")]
|
||||
ParentOverflow,
|
||||
#[error("Too many parents")]
|
||||
DbError(#[from] sea_orm::DbErr),
|
||||
#[error("User not found, please contact technical support")]
|
||||
UserNotFoundByJwtId,
|
||||
#[error("Too many parents")]
|
||||
ParentOverflow,
|
||||
#[error("User not found, please contact technical support")]
|
||||
UserNotFoundBySessionId,
|
||||
#[error("Crypto hash failed, please contact technical support")]
|
||||
CryptoHashFailed,
|
||||
#[error("Crypto encryption failed, please contact technical support")]
|
||||
CryptoEncryptFailed,
|
||||
#[error("Crypto decryption failed, please contact technical support")]
|
||||
|
|
@ -84,9 +80,7 @@ impl ServiceError {
|
|||
// 500
|
||||
ServiceError::ParentNotFound => 500,
|
||||
ServiceError::DbError(_) => 500,
|
||||
ServiceError::UserNotFoundByJwtId => 500,
|
||||
ServiceError::UserNotFoundBySessionId => 500,
|
||||
ServiceError::CryptoHashFailed => 500,
|
||||
ServiceError::CryptoEncryptFailed => 500,
|
||||
ServiceError::CryptoDecryptFailed => 500,
|
||||
ServiceError::CandidateDetailsNotSet => 500,
|
||||
|
|
@ -106,18 +100,4 @@ impl ServiceError {
|
|||
ServiceError::CsvIntoInnerError => 500,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ServiceError;
|
||||
|
||||
#[test]
|
||||
fn test_service_error_code() {
|
||||
let error = ServiceError::CryptoHashFailed;
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
|
||||
assert!(error.code() >= 100);
|
||||
assert!(error.code() <= 599);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue