next_plaid/
error.rs

1//! Error types for the next-plaid library
2
3use thiserror::Error;
4
5/// Result type alias for next-plaid operations
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Error types that can occur during next-plaid operations
9#[derive(Error, Debug)]
10pub enum Error {
11    /// Error during index creation
12    #[error("Index creation failed: {0}")]
13    IndexCreation(String),
14
15    /// Error during search operation
16    #[error("Search failed: {0}")]
17    Search(String),
18
19    /// Error reading/writing files
20    #[error("IO error: {0}")]
21    Io(#[from] std::io::Error),
22
23    /// Error parsing JSON
24    #[error("JSON error: {0}")]
25    Json(#[from] serde_json::Error),
26
27    /// Error with array dimensions
28    #[error("Shape error: {0}")]
29    Shape(String),
30
31    /// Error loading index
32    #[error("Index load failed: {0}")]
33    IndexLoad(String),
34
35    /// Error during codec operations
36    #[error("Codec error: {0}")]
37    Codec(String),
38
39    /// Invalid configuration
40    #[error("Invalid configuration: {0}")]
41    Config(String),
42
43    /// Error during update operation
44    #[error("Update failed: {0}")]
45    Update(String),
46
47    /// Error during delete operation
48    #[error("Delete failed: {0}")]
49    Delete(String),
50
51    /// Error during filtering/metadata operation
52    #[cfg(feature = "filtering")]
53    #[error("Filtering error: {0}")]
54    Filtering(String),
55
56    /// SQLite database error
57    #[cfg(feature = "filtering")]
58    #[error("SQLite error: {0}")]
59    Sqlite(#[from] rusqlite::Error),
60
61    /// NPY read error
62    #[cfg(feature = "npy")]
63    #[error("NPY read error: {0}")]
64    NpyRead(#[from] ndarray_npy::ReadNpyError),
65
66    /// NPY write error
67    #[cfg(feature = "npy")]
68    #[error("NPY write error: {0}")]
69    NpyWrite(#[from] ndarray_npy::WriteNpyError),
70}