gluesql_redb_storage/
error.rs1use {gluesql_core::error::Error, thiserror::Error as ThisError};
2
3#[derive(ThisError, Debug)]
4pub enum StorageError {
5 #[error("nested transaction is not supported")]
6 NestedTransactionNotSupported,
7 #[error("transaction not found")]
8 TransactionNotFound,
9 #[error("cannot create table with reserved name: {0}")]
10 ReservedTableName(String),
11
12 #[error(transparent)]
13 Glue(#[from] Error),
14
15 #[error(transparent)]
16 RedbDatabase(#[from] redb::DatabaseError),
17 #[error(transparent)]
18 RedbStorage(#[from] redb::StorageError),
19 #[error(transparent)]
20 RedbTable(#[from] redb::TableError),
21 #[error(transparent)]
22 RedbTransaction(Box<redb::TransactionError>),
23 #[error(transparent)]
24 RedbCommit(#[from] redb::CommitError),
25
26 #[error(transparent)]
27 Bincode(#[from] bincode::Error),
28}
29
30impl From<StorageError> for Error {
31 fn from(e: StorageError) -> Error {
32 Error::StorageMsg(e.to_string())
33 }
34}
35
36impl From<redb::TransactionError> for StorageError {
37 fn from(e: redb::TransactionError) -> StorageError {
38 StorageError::RedbTransaction(Box::new(e))
39 }
40}