use thiserror::Error; /// Error types for OurDB operations #[derive(Error, Debug)] pub enum Error { /// IO errors from file operations #[error("IO error: {0}")] Io(#[from] std::io::Error), /// Data corruption errors #[error("Data corruption: {0}")] DataCorruption(String), /// Invalid operation errors #[error("Invalid operation: {0}")] InvalidOperation(String), /// Lookup table errors #[error("Lookup error: {0}")] LookupError(String), /// Record not found errors #[error("Record not found: {0}")] NotFound(String), /// Other errors #[error("Error: {0}")] Other(String), } impl From for Error { fn from(msg: String) -> Self { Error::Other(msg) } } impl From<&str> for Error { fn from(msg: &str) -> Self { Error::Other(msg.to_string()) } }