codex_memory/memory/
error.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum MemoryError {
5 #[error("Database error: {0}")]
6 Database(#[from] sqlx::Error),
7
8 #[error("Duplicate content found in tier {tier}")]
9 DuplicateContent { tier: String },
10
11 #[error("Memory not found: {id}")]
12 NotFound { id: String },
13
14 #[error("Invalid tier transition from {from} to {to}")]
15 InvalidTierTransition { from: String, to: String },
16
17 #[error("Migration failed: {reason}")]
18 MigrationFailed { reason: String },
19
20 #[error("Connection pool error: {0}")]
21 ConnectionPool(String),
22
23 #[error("Serialization error: {0}")]
24 Serialization(#[from] serde_json::Error),
25
26 #[error("IO error: {0}")]
27 Io(#[from] std::io::Error),
28
29 #[error("Configuration error: {0}")]
30 Configuration(String),
31
32 #[error("Validation error: {0}")]
33 Validation(String),
34
35 #[error("Invalid request: {message}")]
36 InvalidRequest { message: String },
37
38 #[error("Unknown error: {0}")]
39 Unknown(String),
40}
41
42pub type Result<T> = std::result::Result<T, MemoryError>;