1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum VectorDBError {
6 #[error("Collection not found: {0}")]
8 CollectionNotFound(String),
9
10 #[error("Collection already exists: {0}")]
12 CollectionExists(String),
13
14 #[error("Dimension mismatch in collection '{collection}': expected {expected}, got {actual}")]
16 DimensionMismatch {
17 collection: String,
19 expected: usize,
21 actual: usize,
23 },
24
25 #[error("Storage error: {0}")]
27 StorageError(String),
28
29 #[error("IO error: {0}")]
31 IoError(#[from] std::io::Error),
32
33 #[error("Serialization error: {0}")]
35 SerializationError(#[from] serde_json::Error),
36}
37
38pub type VectorDBResult<T> = Result<T, VectorDBError>;