Skip to main content

ruvector_diskann/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, DiskAnnError>;
4
5#[derive(Error, Debug)]
6pub enum DiskAnnError {
7    #[error("IO error: {0}")]
8    Io(#[from] std::io::Error),
9
10    #[error("Dimension mismatch: expected {expected}, got {actual}")]
11    DimensionMismatch { expected: usize, actual: usize },
12
13    #[error("Index not built — call build() first")]
14    NotBuilt,
15
16    #[error("Index is empty")]
17    Empty,
18
19    #[error("ID not found: {0}")]
20    NotFound(String),
21
22    #[error("PQ not trained — call train() first")]
23    PqNotTrained,
24
25    #[error("Invalid config: {0}")]
26    InvalidConfig(String),
27
28    #[error("Serialization error: {0}")]
29    Serialization(String),
30}