Skip to main content

cognee_graph/
error.rs

1//! Error types for graph database operations.
2
3use thiserror::Error;
4
5/// Result type for graph database operations.
6pub type GraphDBResult<T> = Result<T, GraphDBError>;
7
8/// Errors that can occur during graph database operations.
9#[derive(Error, Debug)]
10pub enum GraphDBError {
11    /// Database initialization failed
12    #[error("Failed to initialize database: {0}")]
13    InitializationError(String),
14
15    /// Query execution failed
16    #[error("Query execution failed: {0}")]
17    QueryError(String),
18
19    /// Node operation failed
20    #[error("Node operation failed: {0}")]
21    NodeError(String),
22
23    /// Edge operation failed
24    #[error("Edge operation failed: {0}")]
25    EdgeError(String),
26
27    /// Serialization/deserialization error
28    #[error("Serialization error: {0}")]
29    SerializationError(#[from] serde_json::Error),
30
31    /// Connection error
32    #[error("Connection error: {0}")]
33    ConnectionError(String),
34
35    /// Generic database error
36    #[error("Database error: {0}")]
37    DatabaseError(String),
38}