Files
sausage/host/src/cred/error.rs
T

21 lines
579 B
Rust

//! Stable failures. Never include input values or script exception messages.
#[derive(Debug, thiserror::Error)]
#[error("credential operation failed: {0}")]
pub struct Error(pub &'static str);
pub type Result<T> = std::result::Result<T, Error>;
impl From<rusqlite::Error> for Error {
fn from(_: rusqlite::Error) -> Self {
Self("storage")
}
}
impl From<std::io::Error> for Error {
fn from(_: std::io::Error) -> Self {
Self("io")
}
}
impl From<serde_json::Error> for Error {
fn from(_: serde_json::Error) -> Self {
Self("json")
}
}