Skip to main content

connectorx/sources/oracle/
errors.rs

1use std::string::FromUtf8Error;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum OracleSourceError {
6    #[error(transparent)]
7    ConnectorXError(#[from] crate::errors::ConnectorXError),
8
9    #[error(transparent)]
10    OracleError(#[from] r2d2_oracle::oracle::Error),
11
12    #[error(transparent)]
13    OraclePoolError(#[from] r2d2::Error),
14
15    #[error(transparent)]
16    OracleUrlError(#[from] url::ParseError),
17
18    #[error(transparent)]
19    OracleUrlDecodeError(#[from] FromUtf8Error),
20
21    #[error(transparent)]
22    DecimalError(#[from] rust_decimal::Error),
23
24    /// The query returns a native `BOOLEAN` column, but the loaded Oracle Instant Client
25    /// cannot be trusted to read it.
26    #[error(
27        "column {column} is a native BOOLEAN, but Oracle Instant Client {client} can return \
28         wrong BOOLEAN values without raising an error. Upgrade Instant Client to 23.5 or \
29         later, or convert the column in SQL, e.g. CAST({column} AS NUMBER)"
30    )]
31    UnreliableBooleanClient {
32        /// Name of the first `BOOLEAN` column in the result.
33        column: String,
34        /// Instant Client version reported by `oracle::Version::client()`.
35        client: String,
36    },
37
38    /// Any other errors that are too trivial to be put here explicitly.
39    #[error(transparent)]
40    Other(#[from] anyhow::Error),
41}