reflex/vectordb/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4/// Errors returned by vector database operations.
5pub enum VectorDbError {
6    /// Could not connect to the Qdrant endpoint.
7    #[error("failed to connect to Qdrant at '{url}': {message}")]
8    ConnectionFailed {
9        /// Endpoint URL.
10        url: String,
11        /// Error message.
12        message: String,
13    },
14
15    /// Collection creation failed.
16    #[error("failed to create collection '{collection}': {message}")]
17    CreateCollectionFailed {
18        /// Collection name.
19        collection: String,
20        /// Error message.
21        message: String,
22    },
23
24    /// Collection does not exist.
25    #[error("collection not found: {collection}")]
26    CollectionNotFound {
27        /// Collection name.
28        collection: String,
29    },
30
31    /// Upsert failed.
32    #[error("failed to upsert points to '{collection}': {message}")]
33    UpsertFailed {
34        /// Collection name.
35        collection: String,
36        /// Error message.
37        message: String,
38    },
39
40    /// Search failed.
41    #[error("failed to search in '{collection}': {message}")]
42    SearchFailed {
43        /// Collection name.
44        collection: String,
45        /// Error message.
46        message: String,
47    },
48
49    /// Vector dimension mismatch.
50    #[error("invalid vector dimension: expected {expected}, got {actual}")]
51    InvalidDimension {
52        /// Expected dimension.
53        expected: usize,
54        /// Actual dimension.
55        actual: usize,
56    },
57
58    /// Embedding bytes had the wrong length.
59    #[error("invalid embedding byte length: expected {expected} bytes, got {actual}")]
60    InvalidEmbeddingBytesLength {
61        /// Expected byte length.
62        expected: usize,
63        /// Actual byte length.
64        actual: usize,
65    },
66
67    /// Delete failed.
68    #[error("failed to delete points from '{collection}': {message}")]
69    DeleteFailed {
70        /// Collection name.
71        collection: String,
72        /// Error message.
73        message: String,
74    },
75}