velesdb_core/
error.rs

1//! Error types for `VelesDB`.
2
3use thiserror::Error;
4
5/// Result type alias for `VelesDB` operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur in `VelesDB` operations.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// Collection already exists.
12    #[error("Collection '{0}' already exists")]
13    CollectionExists(String),
14
15    /// Collection not found.
16    #[error("Collection '{0}' not found")]
17    CollectionNotFound(String),
18
19    /// Point not found.
20    #[error("Point with ID '{0}' not found")]
21    PointNotFound(u64),
22
23    /// Dimension mismatch.
24    #[error("Vector dimension mismatch: expected {expected}, got {actual}")]
25    DimensionMismatch {
26        /// Expected dimension.
27        expected: usize,
28        /// Actual dimension.
29        actual: usize,
30    },
31
32    /// Invalid vector.
33    #[error("Invalid vector: {0}")]
34    InvalidVector(String),
35
36    /// Storage error.
37    #[error("Storage error: {0}")]
38    Storage(String),
39
40    /// Index error.
41    #[error("Index error: {0}")]
42    Index(String),
43
44    /// IO error.
45    #[error("IO error: {0}")]
46    Io(#[from] std::io::Error),
47
48    /// Serialization error.
49    #[error("Serialization error: {0}")]
50    Serialization(String),
51
52    /// Internal error.
53    #[error("Internal error: {0}")]
54    Internal(String),
55}