Component.render() is silently swallowing errors with no console output
See original GitHub issueA 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.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why do programmers sometimes silently swallow exceptions?
@Sjoerd: Swallowing an exception without a comment means he made a mistake. It doesn't say anything in particular about whether or not he's...
Read more >Are JavaScript Promises swallowing your errors?
JavaScript Promises swallow your errors by default, causing untold pain while debugging. Learn how to keep yourself sane by handling errors ...
Read more >apex:actionSupport swallowing JavaScript errors
Is there a better way to handle exceptions with an apex:actionSupport? I manually called the same JavaScript method via the console and was...
Read more >Changelog - Cypress Documentation
Previously some commands inside a .within() callback would silently select ... "Open in IDE" is no longer displayed in the command log for...
Read more >rollup.js
incrementer.js'; console.log(count); // 0 increment(); console.log(count); // 1 count += 1; // Error — only incrementer.js can change this ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hurrtz
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!
Turn out it was a Promise eating the error. In the flux store triggered by a parent.