#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("{0}")]
Msg(String),
#[error("{0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
Json(#[from] serde_json::Error),
#[error("{0}")]
Age(String),
}
pub type Result<T> = std::result::Result<T, Error>;
impl Error {
pub fn msg(message: impl Into<String>) -> Self {
Self::Msg(message.into())
}
}
impl From<age::EncryptError> for Error {
fn from(e: age::EncryptError) -> Self {
Self::Age(format!("encryption failed: {e}"))
}
}
impl From<age::DecryptError> for Error {
fn from(e: age::DecryptError) -> Self {
Self::Age(format!("decryption failed: {e}"))
}
}