mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 19:11:06 +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")]
|
#[error("Parrent not found")]
|
||||||
ParentNotFound,
|
ParentNotFound,
|
||||||
#[error("Database error")]
|
#[error("Database error")]
|
||||||
ParentOverflow,
|
|
||||||
#[error("Too many parents")]
|
|
||||||
DbError(#[from] sea_orm::DbErr),
|
DbError(#[from] sea_orm::DbErr),
|
||||||
#[error("User not found, please contact technical support")]
|
#[error("Too many parents")]
|
||||||
UserNotFoundByJwtId,
|
ParentOverflow,
|
||||||
#[error("User not found, please contact technical support")]
|
#[error("User not found, please contact technical support")]
|
||||||
UserNotFoundBySessionId,
|
UserNotFoundBySessionId,
|
||||||
#[error("Crypto hash failed, please contact technical support")]
|
|
||||||
CryptoHashFailed,
|
|
||||||
#[error("Crypto encryption failed, please contact technical support")]
|
#[error("Crypto encryption failed, please contact technical support")]
|
||||||
CryptoEncryptFailed,
|
CryptoEncryptFailed,
|
||||||
#[error("Crypto decryption failed, please contact technical support")]
|
#[error("Crypto decryption failed, please contact technical support")]
|
||||||
|
|
@ -84,9 +80,7 @@ impl ServiceError {
|
||||||
// 500
|
// 500
|
||||||
ServiceError::ParentNotFound => 500,
|
ServiceError::ParentNotFound => 500,
|
||||||
ServiceError::DbError(_) => 500,
|
ServiceError::DbError(_) => 500,
|
||||||
ServiceError::UserNotFoundByJwtId => 500,
|
|
||||||
ServiceError::UserNotFoundBySessionId => 500,
|
ServiceError::UserNotFoundBySessionId => 500,
|
||||||
ServiceError::CryptoHashFailed => 500,
|
|
||||||
ServiceError::CryptoEncryptFailed => 500,
|
ServiceError::CryptoEncryptFailed => 500,
|
||||||
ServiceError::CryptoDecryptFailed => 500,
|
ServiceError::CryptoDecryptFailed => 500,
|
||||||
ServiceError::CandidateDetailsNotSet => 500,
|
ServiceError::CandidateDetailsNotSet => 500,
|
||||||
|
|
@ -107,17 +101,3 @@ impl ServiceError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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