nostrdb-rs

nostrdb in rust!
git clone git://jb55.com/nostrdb-rs
Log | Files | Refs | Submodules | README | LICENSE

error.rs (787B)


      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 }
     13 
     14 impl fmt::Display for Error {
     15     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     16         let s = match self {
     17             Error::DbOpenFailed => "Open failed",
     18             Error::NotFound => "Not found",
     19             Error::QueryError => "Query failed",
     20             Error::DecodeError => "Decode error",
     21             Error::NoteProcessFailed => "Note process failed",
     22             Error::TransactionFailed => "Transaction failed",
     23             Error::SubscriptionError => "Subscription failed",
     24         };
     25         write!(f, "{}", s)
     26     }
     27 }
     28 
     29 impl std::error::Error for Error {}