oxisql_sqlite_compat/
error.rs1use oxisql_core::OxiSqlError;
4
5#[derive(Debug, thiserror::Error)]
12pub enum SqliteCompatError {
13 #[error("limbo execution error: {0}")]
17 Limbo(String),
18
19 #[error("type mapping error: {0}")]
21 TypeMap(String),
22
23 #[error("connection error: {0}")]
25 Connection(String),
26
27 #[error("transaction already active — nested transactions are not supported")]
29 NestedTransaction,
30
31 #[error("schema introspection error: {0}")]
33 Schema(String),
34
35 #[error("{0}")]
37 Other(String),
38}
39
40impl From<limbo::Error> for SqliteCompatError {
41 fn from(e: limbo::Error) -> Self {
42 SqliteCompatError::Limbo(e.to_string())
43 }
44}
45
46impl From<SqliteCompatError> for OxiSqlError {
47 fn from(e: SqliteCompatError) -> Self {
48 match e {
49 SqliteCompatError::Limbo(msg) => OxiSqlError::Execution(msg),
50 SqliteCompatError::TypeMap(msg) => OxiSqlError::Other(msg),
51 SqliteCompatError::Connection(msg) => OxiSqlError::Other(msg),
52 SqliteCompatError::NestedTransaction => {
53 OxiSqlError::Other("nested transactions are not supported".into())
54 }
55 SqliteCompatError::Schema(msg) => OxiSqlError::Other(msg),
56 SqliteCompatError::Other(msg) => OxiSqlError::Other(msg),
57 }
58 }
59}