Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

fix: handle IOException on OkHttp interceptor

Description

This MR handles IOException inside OkHttp Interceptor's chain() method and returns a new HTTP response with custom code, message and body. The response is then propagated to the chain, maintaining the application's flow.

Tests

Tests are performed on an Android emulator to mimic a poor network connection. App Lounge is installed on a Google Play system image. The network type was set to EDGE and signal strength to poor.

Issues

https://gitlab.e.foundation/e/os/backlog/-/issues/2512?show=34810

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Summary by CodeRabbit

  • New Features

    • Enhanced error handling for network requests, allowing the app to manage IOException gracefully.
    • Custom responses are now generated for network errors, improving user experience during connectivity issues.
    • Introduced unit tests to validate the behavior of the interceptor, ensuring proper header management and response handling.
  • Bug Fixes

    • Improved stability by preventing application crashes due to unhandled network exceptions.
Edited by CodeRabbitAI

Merge request reports

Loading