wowaweewa
This commit is contained in:
21
backend/src/error.rs
Normal file
21
backend/src/error.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AppError {
|
||||
#[error("invalid configuration: {0}")]
|
||||
InvalidConfig(String),
|
||||
#[error("read-only mode enabled")]
|
||||
ReadOnly,
|
||||
#[error("path outside configured roots: {0}")]
|
||||
PathViolation(String),
|
||||
#[error("whitelisted directory protected: {0}")]
|
||||
WhitelistProtected(String),
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("serde json error: {0}")]
|
||||
SerdeJson(#[from] serde_json::Error),
|
||||
#[error("sqlx error: {0}")]
|
||||
Sqlx(#[from] sqlx::Error),
|
||||
}
|
||||
|
||||
pub type AppResult<T> = Result<T, AppError>;
|
||||
Reference in New Issue
Block a user