Skip to main content

velesdb_core/agent/
error.rs

1#![allow(missing_docs)] // Documentation will be added in follow-up PR
2//! Error types for `AgentMemory` operations.
3
4use super::snapshot::SnapshotError;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum AgentMemoryError {
9    #[error("Failed to initialize memory: {0}")]
10    InitializationError(String),
11
12    #[error("Collection error: {0}")]
13    CollectionError(String),
14
15    #[error("Item not found: {0}")]
16    NotFound(String),
17
18    #[error("Invalid embedding dimension: expected {expected}, got {actual}")]
19    DimensionMismatch { expected: usize, actual: usize },
20
21    #[error("Database error: {0}")]
22    DatabaseError(#[from] crate::error::Error),
23
24    #[error("Snapshot error: {0}")]
25    SnapshotError(String),
26
27    #[error("IO error: {0}")]
28    IoError(String),
29}
30
31impl From<SnapshotError> for AgentMemoryError {
32    fn from(e: SnapshotError) -> Self {
33        Self::SnapshotError(e.to_string())
34    }
35}
36
37impl From<std::io::Error> for AgentMemoryError {
38    fn from(e: std::io::Error) -> Self {
39        Self::IoError(e.to_string())
40    }
41}