a3s_orm/drivers/sqlite/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum SqliteError {
3 #[error("SQLite operation failed: {0}")]
4 Database(#[from] tokio_rusqlite::rusqlite::Error),
5 #[error("SQLite task failed: {0}")]
6 Async(#[from] tokio_rusqlite::Error),
7 #[error("unsigned integer {0} is too large for SQLite")]
8 UnsignedOverflow(u64),
9 #[error("SQLite does not support bound {0} values")]
10 UnsupportedParameter(&'static str),
11}
12
13#[derive(Debug, thiserror::Error)]
14pub enum SqliteTransactionError<E>
15where
16 E: std::error::Error + Send + Sync + 'static,
17{
18 #[error("could not start SQLite transaction: {0}")]
19 Begin(#[source] SqliteError),
20 #[error("transaction operation failed: {0}")]
21 Operation(#[source] E),
22 #[error("could not commit SQLite transaction: {0}")]
23 Commit(#[source] SqliteError),
24 #[error("transaction operation failed ({operation}) and rollback failed ({rollback})")]
25 OperationAndRollback { operation: E, rollback: SqliteError },
26}
27
28#[derive(Debug, thiserror::Error)]
29pub enum SqliteSavepointError<E>
30where
31 E: std::error::Error + Send + Sync + 'static,
32{
33 #[error("could not create SQLite savepoint: {0}")]
34 Begin(#[source] SqliteError),
35 #[error("savepoint operation failed: {0}")]
36 Operation(#[source] E),
37 #[error("could not release SQLite savepoint: {0}")]
38 Release(#[source] SqliteError),
39 #[error("savepoint operation failed ({operation}) and cleanup failed ({cleanup})")]
40 OperationAndCleanup { operation: E, cleanup: SqliteError },
41}
42
43#[derive(Debug, thiserror::Error)]
44pub enum SqliteMigrationError {
45 #[error(transparent)]
46 Driver(#[from] SqliteError),
47 #[error(transparent)]
48 Migration(#[from] crate::MigrationError),
49 #[error("SQLite migration {version:?} failed: {source}")]
50 Apply {
51 version: String,
52 #[source]
53 source: tokio_rusqlite::rusqlite::Error,
54 },
55}