Skip to main content

probabilistic_rs/bloom/
error.rs

1use thiserror::Error;
2
3pub type BloomResult<T> = std::result::Result<T, BloomError>;
4
5#[derive(Error, Debug)]
6pub enum BloomError {
7    #[error("Index out of bounds: {index} >= {capacity}")]
8    IndexOutOfBounds { index: usize, capacity: usize },
9
10    #[error("Invalid configuration: {0}")]
11    InvalidConfig(String),
12
13    #[error("Capacity must be greater than 0")]
14    ZeroCapacity,
15
16    #[error("False positive rate must be between 0 and 1, got {rate}")]
17    InvalidFalsePositiveRate { rate: f64 },
18
19    #[error("Storage backend error: {0}")]
20    StorageError(String),
21
22    #[error("Serialization error: {0}")]
23    SerializationError(String),
24
25    #[error("No configuration found in storage")]
26    ConfigNotFound,
27
28    #[error("No snapshot data found in storage")]
29    SnapshotNotFound,
30
31    #[cfg(feature = "fjall")]
32    #[error("Fjall error: {0}")]
33    FjallError(#[from] Box<fjall::Error>),
34}