Automattic / Automattic/wordpress-rs
Add user-facing error messages to Swift API discovery
- Dominant language
- Rust
- Stars
- 36
- Forks
- 5
- Avg merge
- 17h 30m
- Merged PRs (30d)
- 43
Description
## Summary
The Kotlin wrapper has `ApiDiscoveryResult.userFacingErrorMessage(url:)` that maps API discovery failures to human-readable strings (offline, invalid SSL, not a WordPress site, etc.). The Swift side currently surfaces raw `error.localizedDescription` in the example app's `LoginView`, which produces unhelpful messages.
## Context
Added in PR #1190 for Kotlin:
- `native/kotlin/api/kotlin/src/main/kotlin/rs/wordpress/api/kotlin/ApiDiscoveryResult.kt`
We should align this approaches so they're similar. Kotlin's intermediate layer is much smaller, but we probably want to derive the user-facing error in Rust and share the approach.
## Files to change
- `native/swift/Sources/wordpress-api/` — add error extension with user-facing messages
- `native/swift/Example/Example/UI/LoginView.swift` — use the new messages in `handleLoginError()`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with native/kotlin/api/kotlin/src/main/kotlin/rs/wordpress/api/kotlin/ApiDiscoveryResult.kt to understand the existing user-facing error mappings. Then inspect native/swift/Sources/wordpress-api/ and Example/Example/UI/LoginView.swift, especially handleLoginError(). Done means Swift discovery failures produce human-readable messages instead of raw error.localizedDescription, with the approach aligned across platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, rust, swift
- Domain
- api, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100