common/coordinator/
error.rs1#[derive(Debug, Clone)]
3pub enum WriteError {
4 Backpressure,
6 Shutdown,
8 ApplyError(u64, String),
10 FlushError(String),
12 Internal(String),
14}
15
16impl std::fmt::Display for WriteError {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 match self {
19 WriteError::Backpressure => write!(f, "write queue is full, backpressure applied"),
20 WriteError::Shutdown => write!(f, "coordinator has been dropped/shutdown"),
21 WriteError::ApplyError(epoch, msg) => {
22 write!(f, "error applying write @{}: {}", epoch, msg)
23 }
24 WriteError::FlushError(msg) => write!(f, "error flushing delta: {}", msg),
25 WriteError::Internal(msg) => write!(f, "internal error: {}", msg),
26 }
27 }
28}
29
30impl std::error::Error for WriteError {}
31
32pub type WriteResult<T> = Result<T, WriteError>;