Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #97 from Tropix126/fix/smart-port-eaddrinuse
Browse files Browse the repository at this point in the history
fix: handle `EADDRINUSE` in smart port errors
  • Loading branch information
Gavin-Niederman authored Mar 1, 2024
2 parents 8ff512e + d62e667 commit edcb299
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Before releasing:

- Fix error handling and error type variats in ADI bindings
- Fix `AsynRobot` only running opcontrol
- Properly handle `EADDRINUSE` return for smart port errors (**Breaking Change**) (#97)

### Changed

Expand Down
3 changes: 3 additions & 0 deletions packages/pros/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ pub enum PortError {
PortOutOfRange,
/// The specified port couldn't be configured as the specified type.
PortCannotBeConfigured,
/// The specified port is already being used or is mismatched.
AlreadyInUse,
}

map_errno!(PortError {
ENXIO => Self::PortOutOfRange,
ENODEV => Self::PortCannotBeConfigured,
EADDRINUSE => Self::AlreadyInUse,
});

0 comments on commit edcb299

Please sign in to comment.