Automattic / Automattic/wordpress-rs
isSiteUnreachable returns false for an unreachable host on Android
- Dominant language
- Rust
- Stars
- 36
- Forks
- 5
- Avg merge
- 17h 30m
- Merged PRs (30d)
- 43
Description
On the Kotlin executor, `EHOSTUNREACH` is classified as `HttpError`, so `isSiteUnreachable` returns `false` for it.
`is_site_unreachable` is `NonExistentSiteError | ConnectionError` (`wp_api/src/api_error.rs:742-747`), and both the changelog entry for 0.7.0 and the `ConnectionError` doc comment say it covers the case where "there was no route, or the host was unreachable".
But `WpRequestExecutor.kt:244` catches `NoRouteToHostException` and maps it to `HttpError` via `noRouteToHost()` at `:348-351`. That branch sits ahead of the `ConnectException` branch at `:246`, and `NoRouteToHostException` extends `SocketException` rather than `ConnectException`, so it wins.
The reqwest executor does not have this gap, so the two executors disagree for this case.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.