1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, JournalError>;
6
7#[derive(Error, Debug)]
8pub enum JournalError {
9 #[error("journal full: capacity {0}")]
10 Full(usize),
11
12 #[error("invalid sequence: expected {expected}, got {got}")]
13 InvalidSequence { expected: u64, got: u64 },
14
15 #[error("entry not found: seq {0}")]
16 NotFound(u64),
17
18 #[error("storage error: {0}")]
19 StorageError(String),
20
21 #[error("serialization error: {0}")]
22 SerializationError(String),
23
24 #[error("snapshot error: {0}")]
25 SnapshotError(String),
26
27 #[error("integrity violation at seq {seq}: {reason}")]
28 IntegrityViolation { seq: u64, reason: String },
29}