pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Security error: {0}")]
Generic(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Encryption error: {0}")]
Encryption(#[from] crate::encryption::EncryptionError),
}
impl Error {
pub fn generic<S: Into<String>>(message: S) -> Self {
Self::Generic(message.into())
}
}
impl From<String> for Error {
fn from(message: String) -> Self {
Self::Generic(message)
}
}