[Feature]: Expose errorInfo
from the ErrorBoundary
#9881
Replies: 4 comments
-
I'm having issue not able to wrap a specific component with a custom |
Beta Was this translation helpful? Give feedback.
-
Having the same issue. Would be great to have access to the componentStack |
Beta Was this translation helpful? Give feedback.
-
Duplicate proposal closed in favor of this one: #11206 |
Beta Was this translation helpful? Give feedback.
-
Yeah this is where we've landed in our discussions around this, I think we'll be looking into landing some form of API to let you log this information out/send it to Sentry, etc. - but you won't have it in the
Changes are this will basically be a client-side version of the Remix |
Beta Was this translation helpful? Give feedback.
-
What is the new or updated feature that you are suggesting?
A React
ErrorBoundary
componentDidCatch
exposes two things:error
, which is the thrown errorinfo
, "An object with a componentStack key containing information about which component threw the error"My understanding is that React Router implements an
ErrorBoundary
and forwards the error toerrorElement
, which can get the error by usinguseRouterError
. However, only theerror
is accessible, not theinfo
.My feature request is the following: being able to access, from within the
errorElement
, to theinfo
.I understand that
getDerivedStateFromError
does not exposeinfo
, so it might tricky to access it from theerrorElement
. In this case, anonError(error, info)
callback onRouterProvider
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 ReactErrorBoundary
, given the React Router one takes precedence. Am I wrong?Beta Was this translation helpful? Give feedback.
All reactions