Kotlin executor: OkHttp URL errors escape as internal errors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design, mobile
Research direction
Read WpRequestExecutor.kt around line 95 and the executeRequestSafely error handling. Move request construction into the try and map IllegalArgumentException to RequestExecutionFailed; compare the Swift executor’s .badURL mapping for context. Verify that rejected URLs return a typed error instead of causing a panic through UniFFI.
Written by the indexing model from the issue text.
Description
On Android, a request address OkHttp rejects likely surfaces as an internal error instead of a typed RequestExecutionError.
What happens
WpRequestExecutor.kt:95 builds the OkHttp request with Request.Builder().url(...) outside executeRequestSafely's try/catch. OkHttp throws IllegalArgumentException for some addresses. In uniffi_core 0.32.2, an unexpected exception from a callback becomes a Rust panic, because RequestExecutionError has no From<UnexpectedUniFFICallbackError>.
Who is affected
Login with a typed host:port and no scheme, such as localhost:8080 or example.com:8080. The url crate reads the host as the scheme, and OkHttp rejects the result. An empty or relative XML-RPC RSD link would too (#1757), if that discovery is ever exported.
How this was checked
Found while testing #1746.
- Confirmed: OkHttp 5.4.0's
Request.Builder().url()throwsIllegalArgumentExceptionforexample.invalid:0, an empty string, and relative addresses. It accepts{cdn}hosts. - Not run: the full chain through the Kotlin executor and UniFFI. The panic is read from the uniffi_core source.
Suggested fix
Build the OkHttp Request inside the try, and map IllegalArgumentException to a RequestExecutionFailed. The Swift executor maps .badURL to NonExistentSiteError.
- Dominant language
- Rust
- Stars
- 38
- Forks
- 6
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 50
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/wordpress-rs
-
Error Handling Swift
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/wordpress-rs#1759 ·
Maintainers usually reply within 1 day
-
Bug Login Rust
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/wordpress-rs#1757 ·
Maintainers usually reply within 1 day
-
Expose modified_gmt on PostMetadataCollectionItemPossibly taken @winshaurya claimed this 14 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Automattic/wordpress-rs#1690 · 1 comment ·
Maintainers usually reply within 1 day
-
Bug Kotlin
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/wordpress-rs#1625 · 1 comment ·
Maintainers usually reply within 1 day
-
The offline, cancelled, and generic-fallback branches hardcode `redirects: nil`Possibly taken @jkmassel claimed this 50 days ago. OpenBug Error Handling Swift
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/wordpress-rs#1520 ·
Maintainers usually reply within 1 day
All issues in Automattic/wordpress-rs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
open-telemetry/weaver#1917 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug host P3 web
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jphacks/kz_2613#589 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation pkg:sdk project
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
priority middle
Difficulty 1/5 Under an hour Newbie friendliness 72/100
KATO-Hiro/AtCoderClans#13029 ·
Maintainers usually reply within 1 day