22 lines
606 B
Rust
22 lines
606 B
Rust
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>;
|