diff --git a/Cargo.toml b/Cargo.toml index 8683649..72af595 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ crossbeam-skiplist = { version = "0.1", default-features = false, package = "cro crossbeam-skiplist-mvcc = { version = "0.1" } skl = { version = "0.18", default-features = false, features = ["alloc"] } paste = "1" -thiserror = "1" bytes = { version = "1", default-features = false, optional = true } smallvec = { version = "1", default-features = false, optional = true, features = ["const_generics"] } diff --git a/src/error.rs b/src/error.rs index 42de691..8624042 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,10 +5,9 @@ use derive_where::derive_where; use crate::memtable::BaseTable; /// The batch error type. -#[derive(Debug, thiserror::Error)] +#[derive(Debug)] pub enum BatchError { /// Returned when the expected batch encoding size does not match the actual size. - #[error("the expected batch encoding size ({expected}) does not match the actual size {actual}")] EncodedSizeMismatch { /// The expected size. expected: u32, @@ -16,10 +15,32 @@ pub enum BatchError { actual: u32, }, /// Larger encoding size than the expected batch encoding size. - #[error("larger encoding size than the expected batch encoding size {0}")] LargerEncodedSize(u32), } +impl core::fmt::Display for BatchError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match self { + Self::EncodedSizeMismatch { expected, actual } => { + write!( + f, + "the expected batch encoding size ({}) does not match the actual size {}", + expected, actual + ) + } + Self::LargerEncodedSize(size) => { + write!( + f, + "larger encoding size than the expected batch encoding size {}", + size + ) + } + } + } +} + +impl core::error::Error for BatchError {} + /// The error type. #[derive_where(Debug; T::Error)] pub enum Error {