Skip to main content

connectorx/sources/sqlite/
errors.rs

1use std::string::FromUtf8Error;
2use thiserror::Error;
3
4/// Errors raised by the SQLite source.
5#[derive(Error, Debug)]
6pub enum SQLiteSourceError {
7    /// A column type could not be determined because its first value is `NULL`.
8    #[error("Cannot infer type from null for SQLite")]
9    InferTypeFromNull,
10
11    /// Generic ConnectorX error.
12    #[error(transparent)]
13    ConnectorXError(#[from] crate::errors::ConnectorXError),
14
15    /// Error from the `rusqlite` client.
16    #[error(transparent)]
17    SQLiteError(#[from] rusqlite::Error),
18
19    /// Error from the connection pool.
20    #[error(transparent)]
21    SQLitePoolError(#[from] r2d2::Error),
22
23    /// A percent-encoded part of the connection string is not valid UTF-8.
24    #[error(transparent)]
25    SQLiteUrlDecodeError(#[from] FromUtf8Error),
26
27    /// Any other errors that are too trivial to be put here explicitly.
28    #[error(transparent)]
29    Other(#[from] anyhow::Error),
30}