use thiserror::Error; #[derive(Debug, Error)] pub enum StorageError { #[error("fjall: {0}")] Fjall(#[from] fjall::Error), #[error("corruption at key {key}: {reason}")] Corrupt { key: String, reason: &'static str }, } impl PartialEq for StorageError { fn eq(&self, other: &StorageError) -> bool { match (self, other) { ( StorageError::Corrupt { key: ka, reason: ra, }, StorageError::Corrupt { key: kb, reason: rb, }, ) => ka == kb && ra == rb, _ => unimplemented!(), } } } pub type StorageResult = Result;