init
This commit is contained in:
30
libertas_core/src/error.rs
Normal file
30
libertas_core/src/error.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
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>;
|
||||
Reference in New Issue
Block a user