#[derive(Debug, thiserror::Error)]
pub enum MemoryError {
#[error("no embedding model configured — use Memory::new() instead of Memory::local()")]
NoEmbedder,
#[error("ELID error: {0}")]
Elid(#[from] elid::embeddings::ElidError),
#[error("embedding model error: {0}")]
Embedding(String),
#[error("entry not found: {0}")]
NotFound(String),
#[error("serialization error: {0}")]
Serialization(String),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("backend error: {0}")]
Backend(String),
}
impl From<serde_json::Error> for MemoryError {
fn from(e: serde_json::Error) -> Self {
Self::Serialization(e.to_string())
}
}
impl From<blazen_llm::BlazenError> for MemoryError {
fn from(e: blazen_llm::BlazenError) -> Self {
Self::Embedding(e.to_string())
}
}
pub type Result<T, E = MemoryError> = std::result::Result<T, E>;