Skip to main content

ringdb/
error.rs

1/// All errors that ringdb can produce.
2#[non_exhaustive]
3#[derive(Debug, thiserror::Error)]
4pub enum RingDbError {
5    #[error("dimension mismatch: expected {expected}, got {got}")]
6    DimensionMismatch { expected: usize, got: usize },
7
8    #[error("payload serialization error: {0}")]
9    Payload(String),
10
11    #[error("io error: {0}")]
12    Io(#[from] std::io::Error),
13
14    #[error("corrupt database: {0}")]
15    Corrupt(String),
16
17    #[error("invalid query: {0}")]
18    InvalidQuery(String),
19
20    #[error(
21        "storage mode mismatch: use fetch_pod() for Pod storage and fetch_payload() for Serde storage"
22    )]
23    StorageMismatch,
24}
25
26pub type Result<T> = std::result::Result<T, RingDbError>;