-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Component.render() is silently swallowing errors with no console output #4199
Comments
See #2912. Happy to reopen if a simple case shows React is doing something wrong. |
Hey guys, this is still a thing... I keep debugging for long periods of time because some errors react won't put into the console.log. Here's the most recent example:
Is there any way to enable these errors in dev-mode without manually wrapping code in try-catch blocks? |
@hurrtz could you can share a minimal test case reproducing the issue? You can use https://jsfiddle.net/reactjs/69z2wepo/ as starting point. |
There is most likely nothing to fix in React. React is not catching any errors. The issue you're seeing is most likely due to your call to setState being inside a Promise callback. When exception is thrown, your catch() handler might be swallowing it. Alternatively it may be possible that you don't have a catch() handler, and Promise rejection stays unhandled, but your Promise polyfill might not log unhandled rejection. In this case I recommend changing the Promise polyfill. If you're sure it's a problem with React then please help us by providing a case reproducing it. Thanks! |
Ok, this was on me. I have found no promises anywhere in my project but after I have completely overhauled my webpack configuration (and also my webpack dev server configuration) everything (including errors) showed up as expected. So, still not really sure where the issue was but obviously it was somewhere in my webpack configs. |
@hurrtz Currently experiencing this same silent errors and I suspect it might be our webpack config too. Do you by any chance have your the before and after webpack config files? Or care to share what changed in webpack? |
Turn out it was a Promise eating the error. In the flux store triggered by a parent. |
A piece of code in my render function is error-ing. A simple try/catch was able to capture and display the error, but without it React just silently proceeds by returning
null
in the render function and no error which makes it very difficult to find. Basically if the error happens, render fails silently and displays an empty component.I am coming up with a JSFiddle to reprod in a simpler case for you to debug.
The text was updated successfully, but these errors were encountered: