[error] implement std::error::Error

This commit is contained in:
Alekos Filini 2020-08-17 10:58:45 +02:00
parent 895c6b0808
commit f54243fd18
No known key found for this signature in database
GPG Key ID: 5E8AFC3034FDFA4F

View File

@ -1,3 +1,5 @@
use std::fmt;
use bitcoin::{Address, OutPoint}; use bitcoin::{Address, OutPoint};
#[derive(Debug)] #[derive(Debug)]
@ -56,6 +58,14 @@ pub enum Error {
Sled(sled::Error), Sled(sled::Error),
} }
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}
impl std::error::Error for Error {}
macro_rules! impl_error { macro_rules! impl_error {
( $from:ty, $to:ident ) => { ( $from:ty, $to:ident ) => {
impl std::convert::From<$from> for Error { impl std::convert::From<$from> for Error {