Skip to content

[Feature]: Expose errorInfo from the ErrorBoundary #9875

Description

@marvinroger

What is the new or updated feature that you are suggesting?

A React ErrorBoundary componentDidCatch exposes two things:

My understanding is that React Router implements an ErrorBoundary and forwards the error to errorElement, which can get the error by using useRouterError. However, only the error is accessible, not the info.

My feature request is the following: being able to access, from within the errorElement, to the info.
I understand that getDerivedStateFromError does not expose info, so it might tricky to access it from the errorElement. In this case, an onError(error, info) callback on RouterProvider might also be a solution?

Why should this feature be included?

Currently, we lose this info and, to my knowledge, there's no way to get it back, as we cannot create our own React ErrorBoundary, given the React Router one takes precedence. Am I wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yet

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions