use thiserror::Error;
#[derive(Debug, Error)]
pub enum StoreError {
#[error("key not found: {0}")]
NotFound(String),
#[error("invalid key: {0}")]
InvalidKey(String),
#[error("io error: {0}")]
Io(String),
#[error("authentication failed")]
Auth,
#[error("connection error: {0}")]
Connection(String),
#[error("unsupported: {0}")]
Unsupported(String),
#[error("store error: {0}")]
Other(String),
}
impl From<std::io::Error> for StoreError {
fn from(e: std::io::Error) -> Self {
match e.kind() {
std::io::ErrorKind::NotFound => StoreError::NotFound(e.to_string()),
_ => StoreError::Io(e.to_string()),
}
}
}