error.rs
1 //! Storage Errors 2 3 use thiserror::Error; 4 5 /// Errors from storage operations 6 #[derive(Error, Debug)] 7 pub enum StorageError { 8 #[error("Backend error: {0}")] 9 Backend(String), 10 11 #[error("Serialization error: {0}")] 12 Serialization(String), 13 14 #[error("Key not found")] 15 NotFound, 16 17 #[error("User not bound")] 18 UserNotBound, 19 } 20 21 impl From<sled::Error> for StorageError { 22 fn from(e: sled::Error) -> Self { 23 StorageError::Backend(e.to_string()) 24 } 25 }