38 lines
719 B
Rust
38 lines
719 B
Rust
|
|
use thiserror::Error;
|
||
|
|
|
||
|
|
#[derive(Error, Debug)]
|
||
|
|
pub enum ArchiveError {
|
||
|
|
#[error("I/O error: {0}")]
|
||
|
|
Io(#[from] std::io::Error),
|
||
|
|
|
||
|
|
#[error("Configuration error: {0}")]
|
||
|
|
Config(String),
|
||
|
|
|
||
|
|
#[error("Data corruption: {0}")]
|
||
|
|
Corruption(String),
|
||
|
|
|
||
|
|
#[error("Encryption error: {0}")]
|
||
|
|
Encryption(String),
|
||
|
|
|
||
|
|
#[error("Not found: {0}")]
|
||
|
|
NotFound(String),
|
||
|
|
|
||
|
|
#[error("Repository is locked: {0}")]
|
||
|
|
Locked(String),
|
||
|
|
|
||
|
|
#[error("Invalid repository: {0}")]
|
||
|
|
InvalidRepo(String),
|
||
|
|
|
||
|
|
#[error("JSON error: {0}")]
|
||
|
|
Json(#[from] serde_json::Error),
|
||
|
|
|
||
|
|
#[error("{0}")]
|
||
|
|
Other(String),
|
||
|
|
}
|
||
|
|
|
||
|
|
impl ArchiveError {
|
||
|
|
pub fn to_error_string(&self) -> String {
|
||
|
|
format!("{}", self)
|
||
|
|
}
|
||
|
|
}
|