ambi_memory/error.rs
1//! Error and result types for the ambi-memory subsystem.
2//!
3//! Defines specialised error variants for KV storage, semantic search,
4//! serialisation, and summary generation backends.
5
6use thiserror::Error;
7
8/// All possible errors that can occur during memory operations.
9#[derive(Error, Debug)]
10pub enum MemoryError {
11 /// An unrecoverable failure in the underlying storage backend.
12 #[error("Memory Backend Error: {0}")]
13 BackendError(String),
14
15 /// A serialisation or deserialisation failure.
16 #[error("Memory Serialization Error: {0}")]
17 SerializationError(String),
18
19 /// The requested key does not exist in the store.
20 #[error("Memory Key Not Found: {0}")]
21 KeyNotFound(String),
22
23 /// An embedding or vector-search operation failed.
24 #[error("Embedding or Semantic Search Error: {0}")]
25 SemanticError(String),
26
27 /// A summarisation LLM call or compression step failed.
28 #[error("Summary Generation Error: {0}")]
29 SummaryError(String),
30}
31
32/// A specialised `Result` type for memory operations.
33pub type Result<T> = std::result::Result<T, MemoryError>;