gbserver/gb-auth/src/lib.rs

30 lines
683 B
Rust
Raw Normal View History

2024-12-22 20:56:52 -03:00
pub mod handlers;
pub mod middleware;
pub mod models;
pub mod services;
pub mod utils;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum AuthError {
#[error("Authentication failed")]
AuthenticationFailed,
#[error("Invalid credentials")]
InvalidCredentials,
#[error("Token expired")]
TokenExpired,
#[error("Invalid token")]
InvalidToken,
2024-12-23 00:54:50 -03:00
#[error("Missing token")]
MissingToken,
2024-12-22 20:56:52 -03:00
#[error("Database error: {0}")]
Database(#[from] sqlx::Error),
#[error("Cache error: {0}")]
Cache(#[from] redis::RedisError),
#[error("Internal error: {0}")]
Internal(String),
}
pub type Result<T> = std::result::Result<T, AuthError>;