use sqlx_core::Error as SqlxError;
use thiserror::Error as ThisError;
use crate::options::URL_SCHEME;
#[derive(Debug, ThisError)]
pub enum ExaConfigError {
#[error("no host provided")]
MissingHost,
#[error("could not resolve hostname")]
CouldNotResolve(#[from] std::io::Error),
#[error("multiple authentication methods provided")]
MultipleAuthMethods,
#[error("invalid URL scheme: {0}, expected: {}", URL_SCHEME)]
InvalidUrlScheme(String),
#[error("invalid connection parameter: {0}")]
InvalidParameter(&'static str),
}
impl From<ExaConfigError> for SqlxError {
fn from(value: ExaConfigError) -> Self {
Self::Configuration(value.into())
}
}