question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component.render() is silently swallowing errors with no console output

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
gaearoncommented, Sep 11, 2016

@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!

2reactions
samit4mecommented, Nov 8, 2016

Turn out it was a Promise eating the error. In the flux store triggered by a parent.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found