alice_core/memory/
error.rs1#[derive(Debug, thiserror::Error, Clone, PartialEq)]
5pub enum MemoryValidationError {
6 #[error("invalid hybrid weights: bm25={bm25}, vector={vector}")]
8 InvalidHybridWeights {
9 bm25: f32,
11 vector: f32,
13 },
14 #[error("recall limit must be greater than zero")]
16 InvalidRecallLimit,
17}
18
19#[derive(Debug, thiserror::Error)]
21pub enum MemoryStoreError {
22 #[error("database error: {0}")]
24 Database(String),
25 #[error("serialization error: {0}")]
27 Serialization(String),
28 #[error(transparent)]
30 Validation(#[from] MemoryValidationError),
31}
32
33#[derive(Debug, thiserror::Error)]
35pub enum MemoryServiceError {
36 #[error(transparent)]
38 Validation(#[from] MemoryValidationError),
39 #[error(transparent)]
41 Store(#[from] MemoryStoreError),
42}
43
44impl From<serde_json::Error> for MemoryStoreError {
45 fn from(value: serde_json::Error) -> Self {
46 Self::Serialization(value.to_string())
47 }
48}