[error] implement std::error::Error
This commit is contained in:
parent
895c6b0808
commit
f54243fd18
10
src/error.rs
10
src/error.rs
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user