Browse Source

error: add timeout error

ghassmo 4 năm trước cách đây
mục cha
commit
e535cc4fd5
1 tập tin đã thay đổi với 18 bổ sung0 xóa
  1. 18 0
      src/error.rs

+ 18 - 0
src/error.rs

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