react-redux: Error handling in connectAdvanced can swallow errors

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

Description:

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?

About this issue

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

Most upvoted comments

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.

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 😃

@Slapbox : we’re multiple major versions and internal rearchitectures past when this issue was closed 😃 Could you open up a separate new issue so we can keep track of your question on its own, and if at all possible include either a CodeSandbox showing the problem or a Replay ( https://replay.io/record-bugs ) of this happening?