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.

Error handling in connectAdvanced can swallow errors

See original GitHub issue

Reported in Reactiflux chat by user “Bahamut”, who was not in a position to file a report himself.


There was a function being defined inside of a mapDispatch function, like:

function mapDispatch(dispatch) {
    return {
        someFunction: () => dispatch({type : "SOME_ACTION", string : `some template literal`})

There was an error in the template literal, and that threw an error when the mapDispatch function was checked by connectAdvanced() at connectAdvanced.js#L15-25.

However, the error was swallowed by the try/catch block there, and no visible error was reported in the console.

So, the important issue here appears to be that we have a try/catch that swallows errors, and doesn’t report them in any way.

Would it be a good idea to use the warning() util to log errors here?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

AlexTwinecommented, Dec 21, 2017

This needs to be fix. I spent a good amount of time trying to figure out why my debugger wasn’t getting hit in the mapState function. The error should show up in the console.

markeriksoncommented, Nov 20, 2022

Realistically, I’m not going to have time to look at this any time soon. But I definitely won’t ever remember to look at it if there’s no new issue filed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling operation errors - Apollo GraphQL Docs
Apollo Client helps you handle these errors according to their type, enabling you to show appropriate information to the user when an error...
Read more >
Error hiding - Wikipedia
When errors are swallowed, these purposes can't be accomplished. Information about the error is lost, which makes it very hard to track down...
Read more >
Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere in their child ... An error boundary can't catch an error within itself....
Read more >
Why shouldn't I use catch() to handle errors in React useEffect ...
Note: it's important to handle errors here instead of a catch() block so that we don't swallow exceptions from actual bugs in components....
Read more >
esxi host not responding but vms still running
I can still ping the host, and ping/rdp to the VMs that are running on it. ... already check the ESXi host's and...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found