Skip to main content

graphmind_sdk/
error.rs

1//! Error types for the Graphmind SDK
2
3use thiserror::Error;
4
5/// Errors that can occur when using the Graphmind SDK
6#[derive(Error, Debug)]
7pub enum GraphmindError {
8    /// Query parsing or execution error
9    #[error("Query error: {0}")]
10    QueryError(String),
11
12    /// Connection error (remote mode)
13    #[error("Connection error: {0}")]
14    ConnectionError(String),
15
16    /// RESP protocol error
17    #[error("Protocol error: {0}")]
18    ProtocolError(String),
19
20    /// HTTP transport error
21    #[error("HTTP error: {0}")]
22    HttpError(#[from] reqwest::Error),
23
24    /// JSON serialization/deserialization error
25    #[error("Serialization error: {0}")]
26    SerializationError(#[from] serde_json::Error),
27
28    /// I/O error
29    #[error("I/O error: {0}")]
30    IoError(#[from] std::io::Error),
31
32    /// Vector search error
33    #[error("Vector error: {0}")]
34    VectorError(String),
35
36    /// Graph algorithm error
37    #[error("Algorithm error: {0}")]
38    AlgorithmError(String),
39
40    /// Persistence error
41    #[error("Persistence error: {0}")]
42    PersistenceError(String),
43}
44
45pub type GraphmindResult<T> = Result<T, GraphmindError>;