Skip to content
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

Do not alter exception thrown from selector #1433

Closed
Dema opened this issue Oct 26, 2019 · 2 comments · Fixed by #1474
Closed

Do not alter exception thrown from selector #1433

Dema opened this issue Oct 26, 2019 · 2 comments · Fixed by #1474

Comments

@Dema
Copy link

Dema commented Oct 26, 2019

Do you want to request a feature or report a bug?
bug

What is the current behavior?

useSelector extracts .message field from thrown exception in https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.js#L60 hiding original exception with stack trace making it hard to pinpoint exact error location.

What is the expected behavior?

Is it possible to re-throw original error or, at least print it using console.error?

@evbots
Copy link

evbots commented Nov 5, 2019

Agreed, this makes my debugging unnecessarily hard.

@timdorr
Copy link
Member

timdorr commented Nov 5, 2019

What about this?

  } catch (err) {
    if (latestSubscriptionCallbackError.current) {
      err.message += `\nThe error may be correlated with this previous error:\n${latestSubscriptionCallbackError.current.stack}\n\n`
    }

    throw err
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants