use config::ConfigError;
use hyper::Error as HyperError;
use metrics::SetRecorderError;
use opentelemetry::trace::TraceError;
use tracing_subscriber::util::TryInitError;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Got ConfigError: `{0}`")]
ConfigError(#[from] ConfigError),
#[error("Got TraceError: `{0}`")]
TraceError(#[from] TraceError),
#[error("Got TryInitError: `{0}`")]
TryInitError(#[from] TryInitError),
#[error("Got HyperError: `{0}`")]
HyperError(#[from] HyperError),
#[error("Got SetRecorderError: `{0}`")]
SetRecorderError(#[from] SetRecorderError),
#[error("Got SerdeError: `{0}`")]
SerdeError(#[from] serde_json::Error),
#[error("Got CustomError: `{0}`")]
CustomError(String),
#[error("Got IoError: `{0}`")]
IoError(#[from] std::io::Error),
#[error("Got OpentelemetryError: `{0}`")]
OpentelemetryError(#[from] opentelemetry::global::Error),
#[cfg(feature = "tls")]
#[error("Got JoinHandleError: `{0}`")]
JoinHandleError(#[from] tokio::task::JoinError),
#[cfg(feature = "tls")]
#[error("Got TlsHandshakeTimeout")]
TlsHandshakeTimeout,
#[cfg(feature = "use_native_tls")]
#[error("Got NativeTlsError: `{0}`")]
NativeTlsError(#[from] tokio_native_tls::native_tls::Error),
#[cfg(feature = "use_rustls")]
#[error("Got RustlsError: `{0}`")]
RustlsError(#[from] tokio_rustls::rustls::Error),
}
pub type Result<T> = std::result::Result<T, Error>;