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

useSelector swallows the stack an error occurred in. #1573

Closed
mattdarveniza opened this issue Apr 28, 2020 · 2 comments
Closed

useSelector swallows the stack an error occurred in. #1573

mattdarveniza opened this issue Apr 28, 2020 · 2 comments

Comments

@mattdarveniza
Copy link

Currently, if you have an error that occurs within a selector, useSelector will catch this and rethrow it, including the stack for latestSubscriptionCallbackError, which is useful when there is a genuine error in latestSubscriptionCallbackError. In the cases where the error has simply occurred within the selector due to a programming or data error, all information about where that error happened is lost, which can be quite infuriating for complex selectors.

All I'm proposing is to print the original error's err.stack, rather than just err.message. This will obviously increase the error size substantially but given the stack is already printed for latestSubscriptionCallbackError, it seems like a reasonable change.

Happy to put together a PR for this, as it's only a one line change + tests from what I can see.

@markerikson
Copy link
Contributor

markerikson commented Apr 28, 2020

Hmm. I thought we did this already over in #1474 . Did we lose that somehow, or is this something different?

@mattdarveniza
Copy link
Author

My mistake, I hadn't seen that issue and PR. Sorry!

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

No branches or pull requests

2 participants