use hyper::http;
use quinn::crypto::rustls::NoInitialCipherSuite;
use rustls;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("CertParse: {0}")]
CertParse(String),
#[error("CertNotFound")]
CertNotFound(String),
#[error("CertExpired")]
CertExpired,
#[error("PrivateKeyNotFound")]
PrivateKeyNotFound,
#[error("PrivateKeyUnsupported: {0}")]
PrivateKeyUnsupported(String),
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[error("http: {0}")]
Http(#[from] http::Error),
#[error("Rustls: {0}")]
Rustls(#[from] rustls::Error),
#[error("NoHost")]
NoHost,
#[error("UpstreamNotFound")]
UpstreamNotFound,
#[error("InvalidHost: {0}")]
InvalidHost(#[from] http::uri::InvalidUri),
#[error("TokioJoin: {0}")]
TokioJoin(#[from] tokio::task::JoinError),
#[error("Infallible: {0}")]
Infallible(#[from] std::convert::Infallible),
#[error("Hyper: {0}")]
Hyper(#[from] hyper::Error),
#[error("QuinnConnection: {0}")]
QuinnConnection(#[from] quinn::ConnectionError),
#[error("QuinnWrite: {0}")]
QuinnWrite(#[from] quinn::WriteError),
#[error("H3Connection: {0}")]
H3Connection(#[from] h3::error::ConnectionError),
#[error("H3Stream: {0}")]
H3Stream(#[from] h3::error::StreamError),
#[error("Quinn crypto: {0}")]
QuinnCrypto(#[from] NoInitialCipherSuite),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;