Skip to content

Commit b6d4a67

Browse files
committed
Merge 'std-error-ReachabilityError'
2 parents c7a1626 + f494e72 commit b6d4a67

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Line wrap the file at 100 chars. Th
2323

2424
## [Unreleased]
2525

26+
### Added
27+
- Added `std::error::Error` implementation for `ReachabilityError`.
28+
2629
## [0.6.1] - 2024-08-22
2730
### Fixed
2831
- Fix `std::net::SocketAddr` conversion to `libc::sockaddr`. This makes `SCNetworkReachability`

system-configuration/src/network_reachability.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ pub enum ReachabilityError {
4242
UnrecognizedFlags(u32),
4343
}
4444

45+
impl Display for ReachabilityError {
46+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
47+
match self {
48+
Self::FailedToDetermineReachability => write!(f, "Failed to determine reachability"),
49+
Self::UnrecognizedFlags(flags) => {
50+
write!(f, "Unrecognized reachability flags: {}", flags)
51+
}
52+
}
53+
}
54+
}
55+
56+
impl Error for ReachabilityError {}
57+
4558
/// Failure to schedule a reachability callback on a runloop.
4659
#[derive(Debug)]
4760
pub struct SchedulingError(());

0 commit comments

Comments
 (0)