31 lines
625 B
Rust
31 lines
625 B
Rust
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum CoreError {
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
#[error("I/O error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Database error: {0}")]
|
|
Database(String),
|
|
|
|
#[error("Validation error: {0}")]
|
|
Validation(String),
|
|
|
|
#[error("{0} not found with id: {1}")]
|
|
NotFound(String, uuid::Uuid),
|
|
|
|
#[error("Duplicate resource: {0}")]
|
|
Duplicate(String),
|
|
|
|
#[error("Authentication failed: {0}")]
|
|
Auth(String),
|
|
|
|
#[error("An unknown error occurred")]
|
|
Unknown,
|
|
}
|
|
|
|
pub type CoreResult<T> = Result<T, CoreError>;
|