mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
24 lines
No EOL
1.1 KiB
Rust
24 lines
No EOL
1.1 KiB
Rust
pub struct Status {
|
|
pub code: u16,
|
|
}
|
|
|
|
pub const INVALID_CREDENTIALS_ERROR: ServiceError = ServiceError(Status { code: 401 },
|
|
"Invalid credentials");
|
|
pub const EXPIRED_SESSION_ERROR: ServiceError = ServiceError(Status { code: 401 },
|
|
"Session expired, please login again");
|
|
|
|
pub const JWT_ERROR: ServiceError = ServiceError(Status { code: 500 },
|
|
"Error while encoding JWT");
|
|
|
|
pub const USER_NOT_FOUND_ERROR: ServiceError = ServiceError(Status { code: 404 },
|
|
"User not found");
|
|
|
|
pub const DB_ERROR: ServiceError = ServiceError(Status { code: 500 },
|
|
"Database error");
|
|
|
|
pub const USER_NOT_FOUND_BY_JWT_ID: ServiceError = ServiceError(Status { code: 500 }, // User got somehow deleted
|
|
"User not found, please contact technical support"); // Shouldn't ever happen
|
|
|
|
pub const USER_NOT_FOUND_BY_SESSION_ID: ServiceError = ServiceError(Status { code: 500 }, // User got somehow deleted
|
|
"User not found, please contact technical support"); // Shouldn't ever happen
|
|
pub struct ServiceError<'a>(pub Status, pub &'a str); |