Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

#![forbid(unsafe_code)]

mod tls;

#[cfg(feature = "runtime")]
mod builder;
#[cfg(feature = "runtime")]
Expand All @@ -49,6 +47,7 @@ pub mod body;
pub mod config;
pub mod error;
pub mod http;
pub mod tls;
pub mod util;

#[cfg(feature = "runtime")]
Expand Down
9 changes: 9 additions & 0 deletions http/src/tls/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub enum TlsError {
Rustls(super::rustls::RustlsError),
#[cfg(feature = "native-tls")]
NativeTls(super::native_tls::NativeTlsError),
OtherTls(Box<dyn error::Error + Send + Sync>),
}

impl fmt::Debug for TlsError {
Expand All @@ -22,6 +23,7 @@ impl fmt::Debug for TlsError {
Self::Rustls(ref e) => fmt::Debug::fmt(e, _f),
#[cfg(feature = "native-tls")]
Self::NativeTls(ref e) => fmt::Debug::fmt(e, _f),
Self::OtherTls(ref e) => fmt::Debug::fmt(e, _f),
}
}
}
Expand All @@ -36,12 +38,19 @@ impl fmt::Display for TlsError {
Self::Rustls(ref e) => fmt::Debug::fmt(e, _f),
#[cfg(feature = "native-tls")]
Self::NativeTls(ref e) => fmt::Display::fmt(e, _f),
Self::OtherTls(ref e) => fmt::Display::fmt(e, _f),
}
}
}

impl error::Error for TlsError {}

impl From<Box<dyn error::Error + Send + Sync>> for TlsError {
fn from(e: Box<dyn error::Error + Send + Sync>) -> Self {
Self::OtherTls(e)
}
}

impl<S, B> From<TlsError> for HttpServiceError<S, B> {
fn from(e: TlsError) -> Self {
Self::Tls(e)
Expand Down
Loading