aboutsummaryrefslogtreecommitdiff
path: root/embassy-net/src
diff options
context:
space:
mode:
authorAlec Cox <[email protected]>2023-08-18 13:50:14 -0700
committerAlec Cox <[email protected]>2023-08-18 14:43:44 -0700
commiteb05a18c452ec6152c50c75f99e57ce769013c68 (patch)
tree171b5df79353b0e5472c408e10ec7a7ff0ac3dab /embassy-net/src
parent0fd9d7400b47f42d1043347cc2982862de7cffc7 (diff)
add error translation to tcp errors
Translation of tpc client ConnectError and Error to the appropriate embedded_io_async errors
Diffstat (limited to 'embassy-net/src')
-rw-r--r--embassy-net/src/tcp.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index c903fb245..1a876692f 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -384,13 +384,20 @@ mod embedded_io_impls {
384 384
385 impl embedded_io_async::Error for ConnectError { 385 impl embedded_io_async::Error for ConnectError {
386 fn kind(&self) -> embedded_io_async::ErrorKind { 386 fn kind(&self) -> embedded_io_async::ErrorKind {
387 embedded_io_async::ErrorKind::Other 387 match self {
388 ConnectError::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset,
389 ConnectError::TimedOut => embedded_io_async::ErrorKind::TimedOut,
390 ConnectError::NoRoute => embedded_io_async::ErrorKind::NotConnected,
391 ConnectError::InvalidState => embedded_io_async::ErrorKind::Other,
392 }
388 } 393 }
389 } 394 }
390 395
391 impl embedded_io_async::Error for Error { 396 impl embedded_io_async::Error for Error {
392 fn kind(&self) -> embedded_io_async::ErrorKind { 397 fn kind(&self) -> embedded_io_async::ErrorKind {
393 embedded_io_async::ErrorKind::Other 398 match self {
399 Error::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset,
400 }
394 } 401 }
395 } 402 }
396 403