]> Untitled Git - bdk/commitdiff
[error] implement std::error::Error
authorAlekos Filini <alekos.filini@gmail.com>
Mon, 17 Aug 2020 08:58:45 +0000 (10:58 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Sun, 30 Aug 2020 18:38:17 +0000 (20:38 +0200)
src/error.rs

index e685a952561b235f30f189d8f634b1b94cdec718..64f499b16a347d4d2a80b8989091dbe3f4c8c931 100644 (file)
@@ -1,3 +1,5 @@
+use std::fmt;
+
 use bitcoin::{Address, OutPoint};
 
 #[derive(Debug)]
@@ -56,6 +58,14 @@ pub enum 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 {
     ( $from:ty, $to:ident ) => {
         impl std::convert::From<$from> for Error {