#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DataStoreError {
NotFound,
AlreadyExists,
SerializationError(String),
IoError(String),
Internal(String),
}
impl std::fmt::Display for DataStoreError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::NotFound => write!(f, "Item not found in data store"),
Self::AlreadyExists => write!(f, "Item already exists in data store"),
Self::SerializationError(msg) => write!(f, "Serialization error: {}", msg),
Self::IoError(msg) => write!(f, "IO error: {}", msg),
Self::Internal(msg) => write!(f, "Internal error: {}", msg),
}
}
}
impl std::error::Error for DataStoreError {}