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

Doesn't work inside promises? #30

Open
Kebabpizza opened this issue Dec 13, 2017 · 9 comments
Open

Doesn't work inside promises? #30

Kebabpizza opened this issue Dec 13, 2017 · 9 comments

Comments

@Kebabpizza
Copy link

It does not seem to catch any errors inside promises for me.

I'm navigating to a different view using react-navigation inside a promise, and no errors are caught after this (or inside the promise itself).

fetchUser().then(() => { this.causeAnError() })

@andrew-wagner89
Copy link

andrew-wagner89 commented Dec 14, 2017

I'm also having a similar problem problem. Regular errors are being caught correctly, but a TypeError in a render caused by a promise isn't caught and the red screen shows on both debug and release builds

@a7ul
Copy link
Owner

a7ul commented Dec 24, 2017

Hmm. That's interesting @Kebabpizza . I ll take a look at that . But @andrew-wagner89 Red screen should never come in the release builds. .as they are entirely switched off during the build process.

@a7ul
Copy link
Owner

a7ul commented Dec 26, 2017

Hi @Kebabpizza @andrew-wagner89 Can you guys help with a screenshot or a larger snippet? .. I am only getting a warning yellow screen after trying to replicate. And yellow screens dont cause a app crash.

@Kebabpizza
Copy link
Author

Hi @master-atul, apologies for the late response.

After navigating to another screen with react-navigation, this produces a crash (red screen) instead of a yellow warning. And if you navigate within a promise react-native-exception-handler does not catch this.

Here is a sample: https://gist.github.com/Kebabpizza/925531ed9bab37ba6abf48f5de9c812a

using
react@16.3.0-alpha.1
react-native@0.54.2
react-native-exception-handler@2.7.1
react-navigation@1.5.8

@maraujop
Copy link

I was hitting this "bug" repeated times after upgrading RN > 0.50 Today I found out that this is due to the new error boundary handling in React 16. You can use componentDidCatch in a root component of your app to handle these scenarios.

You can read more about it here:
https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html

@tonypee
Copy link

tonypee commented Aug 28, 2018

im experiencing this too, which made me think it isnt working at all

@yugandhar-pathi
Copy link

It behaves bit peculiar for me. I tried the example given in the documentation of this plugin (like this.test() ).
I kept this code ( this.test() ) in one of the component life cycle methods, it didn't catch the error !!
Same code( this.test() ) I wrote in one of the button handlers in my component it did catch the error !!

I am not sure why this behavior ??

@yugandhar-pathi
Copy link

I was hitting this "bug" repeated times after upgrading RN > 0.50 Today I found out that this is due to the new error boundary handling in React 16. You can use componentDidCatch in a root component of your app to handle these scenarios.

You can read more about it here:
https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html

That's great! So we don't need this plugin any more right ?

@aroshanzamir
Copy link

What we have to do in functional component (there is not componentDidCatch)?

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

7 participants