Skip to content

useSelector swallows the stack an error occurred in. #1573

Closed
@mattdarveniza

Description

@mattdarveniza

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions