error.rs (598B)
1 use std::io; 2 3 #[derive(thiserror::Error, Debug)] 4 pub enum Error { 5 #[error("timeline not found")] 6 TimelineNotFound, 7 8 #[error("load failed")] 9 LoadFailed, 10 11 #[error("network error: {0}")] 12 Nostr(#[from] enostr::Error), 13 14 #[error("database error: {0}")] 15 Ndb(#[from] nostrdb::Error), 16 17 #[error("io error: {0}")] 18 Io(#[from] io::Error), 19 20 #[error("notedeck app error: {0}")] 21 App(#[from] notedeck::Error), 22 23 #[error("generic error: {0}")] 24 Generic(String), 25 } 26 27 impl From<String> for Error { 28 fn from(s: String) -> Self { 29 Error::Generic(s) 30 } 31 }