1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DbError {
5 #[error("sqlite error: {0}")]
6 Sqlite(#[from] rusqlite::Error),
7
8 #[error("connection pool error: {0}")]
9 Pool(#[from] r2d2::Error),
10
11 #[error("json error: {0}")]
12 Json(#[from] serde_json::Error),
13
14 #[error("migration error: {0}")]
15 Migration(String),
16
17 #[error("core error: {0}")]
18 Core(#[from] scitadel_core::error::CoreError),
19}
20
21impl From<DbError> for scitadel_core::error::CoreError {
22 fn from(e: DbError) -> Self {
23 Self::Adapter("db".to_string(), e.to_string())
24 }
25}