error: add timeout error

This commit is contained in:
ghassmo
2022-04-26 01:36:11 +03:00
parent 313b6ee545
commit e535cc4fd5

View File

@@ -95,6 +95,9 @@ pub enum Error {
#[error("Connection failed")]
ConnectFailed,
#[error("Timeout Error")]
TimeoutError,
#[error("Connection timed out")]
ConnectTimeout,
@@ -341,6 +344,7 @@ impl From<VerifyFailed> for ClientFailed {
}
}
// TEMP
#[cfg(feature = "net2")]
impl<T: std::fmt::Display> From<crate::net2::transport::TransportError<T>> for Error {
fn from(err: crate::net2::transport::TransportError<T>) -> Self {
@@ -348,6 +352,20 @@ impl<T: std::fmt::Display> From<crate::net2::transport::TransportError<T>> for E
}
}
// TEMP
#[cfg(feature = "net3")]
impl<T: std::fmt::Display> From<crate::net3::transport::TransportError<T>> for Error {
fn from(err: crate::net3::transport::TransportError<T>) -> Self {
Self::TransportError(err.to_string())
}
}
impl From<async_std::future::TimeoutError> for Error {
fn from(_err: async_std::future::TimeoutError) -> Self {
Self::TimeoutError
}
}
impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
Self::Io(err.kind())