Skip to content

Conversation

@oguzkocer
Copy link
Contributor

Summary

Fixes exception handling in the Kotlin request executor to prevent UnexpectedUniFFICallbackError crashes. The executor now properly catches and maps all network exceptions (including ConnectException) to appropriate Rust error types instead of letting them propagate uncaught through the UniFFI callback layer.

Changes

  • Add ConnectException handler mapping to HttpError
  • Add catch-all Exception handler mapping to GenericError
  • Add integration test for localhost API discovery

Added comprehensive exception handling to prevent UnexpectedUniFFICallbackError
crashes when network exceptions occur. The executor now properly catches and
maps all exceptions to appropriate Rust error types.

Without proper exception handling, uncaught exceptions from OkHttp would crash
the UniFFI callback layer instead of being returned as proper errors to Rust.
This was causing API discovery and other network operations to fail with
UnexpectedUniFFICallbackError instead of meaningful error messages.

Changes:
- Add ConnectException handler to map connection failures to HttpError
- Add catch-all Exception handler to map unexpected errors to GenericError
- Add testLocalSite integration test to verify localhost API discovery works
@oguzkocer oguzkocer added this to the 0.2 milestone Nov 17, 2025
@oguzkocer oguzkocer marked this pull request as ready for review November 17, 2025 03:54
@oguzkocer oguzkocer enabled auto-merge (squash) November 17, 2025 03:54
Suppress TooGenericExceptionCaught and SwallowedException warnings in the
request executor. These are intentional design choices to ensure all network
exceptions are properly converted to Rust error types instead of crashing
the UniFFI callback layer.
@oguzkocer oguzkocer merged commit 62cbc5e into trunk Nov 17, 2025
22 checks passed
@oguzkocer oguzkocer deleted the fix-wp-request-executor-error-mapping branch November 17, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants