Merge pull request #1802 from avlec/error-translation

Add error translation to tcp errors
This commit is contained in:
Dario Nieuwenhuis 2023-08-18 21:58:27 +00:00 committed by GitHub
commit 7b3cb2ce04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -514,13 +514,20 @@ mod embedded_io_impls {
impl embedded_io_async::Error for ConnectError { impl embedded_io_async::Error for ConnectError {
fn kind(&self) -> embedded_io_async::ErrorKind { fn kind(&self) -> embedded_io_async::ErrorKind {
embedded_io_async::ErrorKind::Other match self {
ConnectError::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset,
ConnectError::TimedOut => embedded_io_async::ErrorKind::TimedOut,
ConnectError::NoRoute => embedded_io_async::ErrorKind::NotConnected,
ConnectError::InvalidState => embedded_io_async::ErrorKind::Other,
}
} }
} }
impl embedded_io_async::Error for Error { impl embedded_io_async::Error for Error {
fn kind(&self) -> embedded_io_async::ErrorKind { fn kind(&self) -> embedded_io_async::ErrorKind {
embedded_io_async::ErrorKind::Other match self {
Error::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset,
}
} }
} }