Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting TypeError in a Promise reject #380

Open
wrldh opened this issue Feb 12, 2024 · 0 comments
Open

Getting TypeError in a Promise reject #380

wrldh opened this issue Feb 12, 2024 · 0 comments

Comments

@wrldh
Copy link

wrldh commented Feb 12, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant