Skip to main content

connectorx/sources/bigquery/
errors.rs

1use gcp_bigquery_client::error::BQError;
2use thiserror::Error;
3use url;
4
5/// Errors raised by the BigQuery source.
6#[derive(Error, Debug)]
7pub enum BigQuerySourceError {
8    /// Generic ConnectorX error.
9    #[error(transparent)]
10    ConnectorXError(#[from] crate::errors::ConnectorXError),
11
12    /// Error from the BigQuery client.
13    #[error(transparent)]
14    BQError(#[from] BQError),
15
16    /// The connection string is not a valid URL.
17    #[error(transparent)]
18    BigQueryUrlError(#[from] url::ParseError),
19
20    /// I/O error, e.g. while reading the service account key.
21    #[error(transparent)]
22    BigQueryStdError(#[from] std::io::Error),
23
24    /// JSON error, e.g. in the service account key.
25    #[error(transparent)]
26    BigQueryJsonError(#[from] serde_json::Error),
27
28    /// A returned value could not be parsed as a float.
29    #[error(transparent)]
30    BigQueryParseFloatError(#[from] std::num::ParseFloatError),
31
32    /// A returned value could not be parsed as an integer.
33    #[error(transparent)]
34    BigQueryParseIntError(#[from] std::num::ParseIntError),
35
36    /// Any other errors that are too trivial to be put here explicitly.
37    #[error(transparent)]
38    Other(#[from] anyhow::Error),
39}