error.rs (863B)
1 use std::fmt; 2 3 #[derive(Debug, Eq, PartialEq)] 4 pub enum Error { 5 DbOpenFailed, 6 NotFound, 7 DecodeError, 8 QueryError, 9 NoteProcessFailed, 10 TransactionFailed, 11 SubscriptionError, 12 BufferOverflow, 13 } 14 15 impl fmt::Display for Error { 16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 17 let s = match self { 18 Error::DbOpenFailed => "Open failed", 19 Error::NotFound => "Not found", 20 Error::QueryError => "Query failed", 21 Error::DecodeError => "Decode error", 22 Error::NoteProcessFailed => "Note process failed", 23 Error::TransactionFailed => "Transaction failed", 24 Error::SubscriptionError => "Subscription failed", 25 Error::BufferOverflow => "Buffer overflow", 26 }; 27 write!(f, "{}", s) 28 } 29 } 30 31 impl std::error::Error for Error {}