]> Untitled Git - bdk/commitdiff
feat(store): add `Bincode` error variant to FileError enum
authornymius <155548262+nymius@users.noreply.github.com>
Tue, 12 Nov 2024 19:29:41 +0000 (16:29 -0300)
committernymius <155548262+nymius@users.noreply.github.com>
Wed, 5 Mar 2025 23:49:58 +0000 (10:49 +1100)
crates/file_store/src/lib.rs

index 7c943ca2006aef624747b42dc7428db36bb4cc9f..dfe5c5c679eac1ec82f1cb654f562c24e3256bd0 100644 (file)
@@ -18,6 +18,8 @@ pub enum FileError {
     Io(io::Error),
     /// Magic bytes do not match what is expected.
     InvalidMagicBytes { got: Vec<u8>, expected: Vec<u8> },
+    /// Failure to decode data from the file.
+    Bincode(bincode::ErrorKind),
 }
 
 impl core::fmt::Display for FileError {
@@ -29,6 +31,7 @@ impl core::fmt::Display for FileError {
                 "file has invalid magic bytes: expected={:?} got={:?}",
                 expected, got,
             ),
+            Self::Bincode(e) => write!(f, "bincode error while reading entry {}", e),
         }
     }
 }