Skip to main content

issundb_vector/
error.rs

1use thiserror::Error;
2
3/// Structured errors representing all vector search and indexing faults.
4#[derive(Debug, Error)]
5pub enum VectorError {
6    #[error("dimension mismatch: index expects {expected}, got {got}")]
7    DimensionMismatch { expected: usize, got: usize },
8
9    #[error(
10        "vector index already configured ({existing}); cannot change to {requested} while vectors exist, use reindex_vector_index to rebuild under the new configuration"
11    )]
12    AlreadyConfigured { existing: String, requested: String },
13
14    #[error(
15        "vector index is empty: this graph has no stored embeddings, upsert vectors before searching"
16    )]
17    EmptyIndex,
18
19    #[error("usearch library fault: {0}")]
20    IndexFault(String),
21
22    #[error("invalid vector configuration: {0}")]
23    InvalidConfig(String),
24
25    #[error(
26        "node {0} does not exist: create the node before giving it an embedding, or the vector is left for whichever node is later allocated that id"
27    )]
28    NodeNotFound(u64),
29
30    #[error("underlying storage error: {0}")]
31    Storage(#[from] issundb_core::Error),
32}