24 lines
No EOL
594 B
Rust
24 lines
No EOL
594 B
Rust
use gb_core::Error as CoreError;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum AuthError {
|
|
#[error("Invalid token")]
|
|
InvalidToken,
|
|
#[error("Invalid credentials")]
|
|
InvalidCredentials,
|
|
#[error("Database error: {0}")]
|
|
Database(#[from] sqlx::Error),
|
|
#[error("Redis error: {0}")]
|
|
Redis(#[from] redis::RedisError),
|
|
#[error("Internal error: {0}")]
|
|
Internal(String),
|
|
}
|
|
|
|
impl From<CoreError> for AuthError {
|
|
fn from(err: CoreError) -> Self {
|
|
match err {
|
|
CoreError { .. } => AuthError::Internal(err.to_string()),
|
|
}
|
|
}
|
|
} |