1#[derive(Debug, Clone)]
2pub enum Error {
3 Storage(String),
4 Serialization(String),
5 InvalidInput(String),
6 Fenced,
7}
8
9impl std::error::Error for Error {}
10
11impl std::fmt::Display for Error {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 match self {
14 Error::Storage(msg) => write!(f, "Storage error: {}", msg),
15 Error::Serialization(msg) => write!(f, "Serialization error: {}", msg),
16 Error::InvalidInput(msg) => write!(f, "Invalid input: {}", msg),
17 Error::Fenced => write!(f, "Consumer fenced: epoch mismatch"),
18 }
19 }
20}
21
22pub type Result<T> = std::result::Result<T, Error>;