-
Notifications
You must be signed in to change notification settings - Fork 268
Description
Current Behavior
I use the library in the standard configuration for detecting online/offline. I also use Sentry for error monitoring and after adding this library to our app, it started getting a lot of strange errors: TypeError: Network request failed setTimeout$argument_0(whatwg-fetch/dist/fetch.... It happens both on iOS and Android.
After investigating it, I found that it happens probably when the app goes to the background. In this case for some reason in xhr.onError callback there's a Error object in this.status (or while getting it) (link to the line in source code), so in result it becomes reject(new TypeError('Network request failed')); which creates a lot of trash events in Sentry.
Expected Behavior
Gracefully handle such errors.
I know the library kinda abandoned, but maybe this issue will help someone in their investigation process.
Your Environment
| software | version |
|---|---|
| react-native-offline | 6.0.2 |
| react-native | 0.71.14 |
| node | 20.3.0 |
| npm or yarn | yarn |