1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum LshError {
6 #[error("dimension mismatch: expected {expected}, got {got}")]
7 DimensionMismatch { expected: usize, got: usize },
8
9 #[error("invalid configuration: {0}")]
10 InvalidConfig(String),
11
12 #[error("index is empty")]
13 EmptyIndex,
14
15 #[error("vector not found: id={0}")]
16 NotFound(usize),
17
18 #[error("num_hashes must be between 1 and 64, got {0}")]
19 InvalidNumHashes(usize),
20
21 #[error("dimension must be greater than 0")]
22 ZeroDimension,
23
24 #[cfg(feature = "persistence")]
25 #[error("serialization error: {0}")]
26 Serialization(String),
27
28 #[cfg(feature = "persistence")]
29 #[error("io error: {0}")]
30 Io(#[from] std::io::Error),
31}
32
33pub type Result<T> = std::result::Result<T, LshError>;