Skip to main content

ankurah_storage_sqlite/
error.rs

1//! Error types for SQLite storage engine
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum SqliteError {
7    #[error("SQLite error: {0}")]
8    Rusqlite(#[from] rusqlite::Error),
9
10    #[error("Connection pool error: {0}")]
11    Pool(String),
12
13    #[error("Serialization error: {0}")]
14    Serialization(#[from] bincode::Error),
15
16    #[error("JSON error: {0}")]
17    Json(#[from] serde_json::Error),
18
19    #[error("DDL error: {0}")]
20    DDL(String),
21
22    #[error("SQL generation error: {0}")]
23    SqlGeneration(String),
24
25    #[error("Task join error: {0}")]
26    TaskJoin(String),
27}
28
29impl From<SqliteError> for ankurah_core::error::RetrievalError {
30    fn from(err: SqliteError) -> Self { ankurah_core::error::RetrievalError::StorageError(Box::new(err)) }
31}
32
33impl From<SqliteError> for ankurah_core::error::MutationError {
34    fn from(err: SqliteError) -> Self { ankurah_core::error::MutationError::General(Box::new(err)) }
35}
36
37impl From<SqliteError> for ankurah_core::error::StateError {
38    fn from(err: SqliteError) -> Self { ankurah_core::error::StateError::DDLError(Box::new(err)) }
39}