Skip to main content

connectorx/sources/mssql/
errors.rs

1use std::string::FromUtf8Error;
2use thiserror::Error;
3
4/// Errors raised by the SQL Server source.
5#[derive(Error, Debug)]
6pub enum MsSQLSourceError {
7    /// The row count of a partition could not be read.
8    #[error("Cannot get # of rows in the partition")]
9    GetNRowsFailed,
10
11    /// Generic ConnectorX error.
12    #[error(transparent)]
13    ConnectorXError(#[from] crate::errors::ConnectorXError),
14
15    /// Error from the `tiberius` client.
16    #[cfg(feature = "src_mssql_tiberius")]
17    #[error(transparent)]
18    MsSQLError(#[from] tiberius::error::Error),
19
20    /// Error while getting a connection from the pool.
21    #[cfg(feature = "src_mssql_tiberius")]
22    #[error(transparent)]
23    MsSQLRuntimeError(#[from] bb8_07::RunError<bb8_tiberius::Error>),
24
25    /// Error from the connection pool manager.
26    #[cfg(feature = "src_mssql_tiberius")]
27    #[error(transparent)]
28    MsSQLPoolError(#[from] bb8_tiberius::Error),
29
30    /// Error from the `mssql-tds` client.
31    #[cfg(feature = "src_mssql_tds")]
32    #[error(transparent)]
33    MsSQLTdsError(#[from] mssql_tds::error::Error),
34
35    /// The connection string is not a valid URL.
36    #[error(transparent)]
37    MsSQLUrlError(#[from] url::ParseError),
38
39    /// A percent-encoded part of the connection string is not valid UTF-8.
40    #[error(transparent)]
41    MsSQLUrlDecodeError(#[from] FromUtf8Error),
42
43    /// Any other errors that are too trivial to be put here explicitly.
44    #[error(transparent)]
45    Other(#[from] anyhow::Error),
46}