Skip to main content

connectorx/sources/trino/
errors.rs

1use std::string::FromUtf8Error;
2
3use thiserror::Error;
4
5/// Errors raised by the Trino source.
6#[derive(Error, Debug)]
7pub enum TrinoSourceError {
8    /// A column type could not be determined because its first value is `NULL`.
9    #[error("Cannot infer type from null for Trino")]
10    InferTypeFromNull,
11
12    /// Generic ConnectorX error.
13    #[error(transparent)]
14    ConnectorXError(#[from] crate::errors::ConnectorXError),
15
16    /// Error from the `prusto` client.
17    #[error(transparent)]
18    PrustoError(prusto::error::Error),
19
20    /// The connection string is not a valid URL.
21    #[error(transparent)]
22    UrlParseError(#[from] url::ParseError),
23
24    /// A percent-encoded part of the connection string is not valid UTF-8.
25    #[error(transparent)]
26    TrinoUrlDecodeError(#[from] FromUtf8Error),
27
28    /// Any other errors that are too trivial to be put here explicitly.
29    #[error(transparent)]
30    Other(#[from] anyhow::Error),
31}