Skip to main content

vecdb_core/
errors.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum VecDbError {
5    #[error("storage error: {0}")]
6    StorageError(String),
7
8    #[error("index error: {0}")]
9    IndexError(String),
10
11    #[error("sparse index error: {0}")]
12    SparseError(String),
13
14    #[error("metadata error: {0}")]
15    MetadataError(String),
16
17    #[error("not found: {id}")]
18    NotFound { id: String },
19
20    #[error("dimension mismatch: expected {expected}, got {got}")]
21    DimensionMismatch { expected: usize, got: usize },
22
23    #[error("collection not found: {0}")]
24    CollectionNotFound(String),
25
26    #[error("collection already exists: {0}")]
27    CollectionAlreadyExists(String),
28
29    #[error("invalid query: {0}")]
30    InvalidQuery(String),
31
32    #[error("serialization error: {0}")]
33    SerializationError(String),
34
35    #[error("IO error: {0}")]
36    IoError(#[from] std::io::Error),
37
38    #[error("SQLite error: {0}")]
39    SqliteError(#[from] rusqlite::Error),
40}
41
42pub type Result<T> = std::result::Result<T, VecDbError>;