Skip to main content

connectorx/sources/postgres/
errors.rs

1use thiserror::Error;
2
3/// Errors raised by the Postgres source.
4#[derive(Error, Debug)]
5pub enum PostgresSourceError {
6    /// Generic ConnectorX error.
7    #[error(transparent)]
8    ConnectorXError(#[from] crate::errors::ConnectorXError),
9
10    /// Error from the connection pool.
11    #[error(transparent)]
12    PostgresPoolError(#[from] r2d2::Error),
13
14    /// Error from the `postgres` client.
15    #[error(transparent)]
16    PostgresError(#[from] postgres::Error),
17
18    /// Error while reading `COPY ... CSV` output.
19    #[error(transparent)]
20    CSVError(#[from] csv::Error),
21
22    /// A `bytea` value in CSV output is not valid hex.
23    #[error(transparent)]
24    HexError(#[from] hex::FromHexError),
25
26    /// I/O error.
27    #[error(transparent)]
28    IOError(#[from] std::io::Error),
29
30    /// Error while setting up TLS.
31    #[error(transparent)]
32    TlsError(#[from] openssl::error::ErrorStack),
33
34    /// Any other errors that are too trivial to be put here explicitly.
35    #[error(transparent)]
36    Other(#[from] anyhow::Error),
37}