forked from nostr/notecrumbs
error: simplify StdError derivation
This commit is contained in:
parent
f4d2ae7b31
commit
eda44cdc93
13
src/error.rs
13
src/error.rs
@ -1,6 +1,5 @@
|
|||||||
use nostr_sdk::nips::nip19;
|
use nostr_sdk::nips::nip19;
|
||||||
use std::array::TryFromSliceError;
|
use std::array::TryFromSliceError;
|
||||||
use std::error::Error as StdError;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -47,14 +46,4 @@ impl fmt::Display for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementing `StdError`
|
impl std::error::Error for Error {}
|
||||||
impl StdError for Error {
|
|
||||||
fn source(&self) -> Option<&(dyn StdError + 'static)> {
|
|
||||||
match self {
|
|
||||||
Error::Nip19(e) => Some(e),
|
|
||||||
Error::Http(e) => Some(e),
|
|
||||||
Error::Nostrdb(e) => Some(e),
|
|
||||||
Error::SliceErr => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user