Skip to main content

zeph_memory/
error.rs

1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4/// Top-level error type for all `zeph-memory` operations.
5///
6/// Wraps database, vector-store, LLM, and serialization errors into a single type
7/// consumed by callers in `zeph-core`.
8///
9/// # Examples
10///
11/// ```rust
12/// use zeph_memory::MemoryError;
13///
14/// fn demo(e: MemoryError) -> String {
15///     e.to_string()
16/// }
17/// ```
18#[derive(Debug, thiserror::Error)]
19pub enum MemoryError {
20    #[error("database error: {0}")]
21    Sqlx(#[from] zeph_db::SqlxError),
22
23    #[error("database error: {0}")]
24    Db(#[from] zeph_db::DbError),
25
26    #[error("Qdrant error: {0}")]
27    Qdrant(#[from] Box<qdrant_client::QdrantError>),
28
29    #[error("vector store error: {0}")]
30    VectorStore(#[from] crate::vector_store::VectorStoreError),
31
32    #[error("LLM error: {0}")]
33    Llm(#[from] zeph_llm::LlmError),
34
35    #[error("JSON error: {0}")]
36    Json(#[from] serde_json::Error),
37
38    #[error("integer conversion: {0}")]
39    IntConversion(#[from] std::num::TryFromIntError),
40
41    #[error("snapshot error: {0}")]
42    Snapshot(String),
43
44    #[error("I/O error: {0}")]
45    Io(#[from] std::io::Error),
46
47    #[error("graph store error: {0}")]
48    GraphStore(String),
49
50    #[error("invalid input: {0}")]
51    InvalidInput(String),
52
53    #[error("{0}")]
54    Other(String),
55
56    #[error("operation timed out: {0}")]
57    Timeout(String),
58}