Files
movies-diary/crates/domain/src/errors.rs
Gabriel Kaszewski 1f8b24fec2 feat(auth): implement JWT authentication and user registration
- Added JWT authentication with token generation and validation.
- Introduced user registration functionality with email and password.
- Integrated Argon2 for password hashing.
- Created SQLite user repository for user data persistence.
- Updated application context to include user repository and configuration settings.
- Added environment variable support for JWT secret and registration allowance.
- Enhanced error handling for unauthorized access and validation errors.
- Updated presentation layer to handle login and registration requests.
2026-05-04 10:43:07 +02:00

20 lines
462 B
Rust

use thiserror::Error;
#[derive(Error, Debug)]
pub enum DomainError {
#[error("Rating must be between 0 and {max}, but received {given}")]
InvalidRating { max: u8, given: u8 },
#[error("Entity not found: {0}")]
NotFound(String),
#[error("Business rule violation: {0}")]
ValidationError(String),
#[error("Infrastructure failure: {0}")]
InfrastructureError(String),
#[error("Unauthorized: {0}")]
Unauthorized(String),
}