use std::num::ParseIntError;
use thiserror::Error;
use url::Url;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum RsdbcErrors {
#[error("Configuration error: `{0}`")]
Configuration(String),
#[error("General error: `{0}`")]
General(String),
#[error("Unsupported error: `{0}`")]
Unsupported(String),
#[error("URL parse error: `{0}`")]
UrlParseError(#[from] url::ParseError),
#[error("Int parse error: `{0}`")]
ParseIntError(#[from] ParseIntError),
#[error("Unknown Database")]
UnknownDatabase,
}
impl RsdbcErrors {
#[allow(dead_code)]
#[inline]
pub fn config(err: String) -> Self {
RsdbcErrors::Configuration(err)
}
}
#[derive(Debug)]
#[non_exhaustive]
pub enum RsdbcError {
BadGrammar,
General,
NonTransient,
NonTransientResource,
PermissionDenied,
Rollback,
Timeout,
Transient,
TransientResource
}