diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-08-18 21:58:27 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-18 21:58:27 +0000 |
| commit | 7b3cb2ce041a81a7644ad752cf009ce1b686e5bd (patch) | |
| tree | 78f2bd2781fcf5c623e305d534dd8087479abdf8 /embassy-net | |
| parent | afd8be416e4936ca84d78a40f1ccf5a346eaec3a (diff) | |
| parent | eb05a18c452ec6152c50c75f99e57ce769013c68 (diff) | |
Merge pull request #1802 from avlec/error-translation
Add error translation to tcp errors
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/tcp.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index ab22ffb70..c92ad2d2e 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -514,13 +514,20 @@ mod embedded_io_impls { | |||
| 514 | 514 | ||
| 515 | impl embedded_io_async::Error for ConnectError { | 515 | impl embedded_io_async::Error for ConnectError { |
| 516 | fn kind(&self) -> embedded_io_async::ErrorKind { | 516 | fn kind(&self) -> embedded_io_async::ErrorKind { |
| 517 | embedded_io_async::ErrorKind::Other | 517 | match self { |
| 518 | ConnectError::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset, | ||
| 519 | ConnectError::TimedOut => embedded_io_async::ErrorKind::TimedOut, | ||
| 520 | ConnectError::NoRoute => embedded_io_async::ErrorKind::NotConnected, | ||
| 521 | ConnectError::InvalidState => embedded_io_async::ErrorKind::Other, | ||
| 522 | } | ||
| 518 | } | 523 | } |
| 519 | } | 524 | } |
| 520 | 525 | ||
| 521 | impl embedded_io_async::Error for Error { | 526 | impl embedded_io_async::Error for Error { |
| 522 | fn kind(&self) -> embedded_io_async::ErrorKind { | 527 | fn kind(&self) -> embedded_io_async::ErrorKind { |
| 523 | embedded_io_async::ErrorKind::Other | 528 | match self { |
| 529 | Error::ConnectionReset => embedded_io_async::ErrorKind::ConnectionReset, | ||
| 530 | } | ||
| 524 | } | 531 | } |
| 525 | } | 532 | } |
| 526 | 533 | ||
