Skip to main content

connectorx/sources/mysql/
errors.rs

1use thiserror::Error;
2
3/// Errors raised by the MySQL source.
4#[derive(Error, Debug)]
5pub enum MySQLSourceError {
6    /// Generic ConnectorX error.
7    #[error(transparent)]
8    ConnectorXError(#[from] crate::errors::ConnectorXError),
9
10    /// Error from the `mysql` client.
11    #[error(transparent)]
12    MySQLError(#[from] r2d2_mysql::mysql::Error),
13
14    /// The connection string is not valid for the `mysql` client.
15    #[error(transparent)]
16    MySQLUrlError(#[from] r2d2_mysql::mysql::UrlError),
17
18    /// Error from the connection pool.
19    #[error(transparent)]
20    MySQLPoolError(#[from] r2d2::Error),
21
22    /// The connection string is not a valid URL.
23    #[error(transparent)]
24    UrlParseError(#[from] url::ParseError),
25
26    /// The `ssl-mode` parameter has an unknown value.
27    #[error("unsupported ssl-mode value: {0}")]
28    InvalidSslMode(String),
29
30    /// Any other errors that are too trivial to be put here explicitly.
31    #[error(transparent)]
32    Other(#[from] anyhow::Error),
33}