Functionality of Sentry's Error Boundary in React #9212
Answered
by
AbhiPrasad
filiptammergard
asked this question in
Q&A
-
Hello! We are using Sentry heavily in our organization, but one thing I can't seem to understand is exactly what added benefit I would get from using The docs say:
https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/ But that's the default behavior, right? Errors from inside a React component tree are always sent to Sentry. So why would I use |
Beta Was this translation helpful? Give feedback.
Answered by
AbhiPrasad
Oct 11, 2023
Replies: 1 comment 5 replies
-
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
filiptammergard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because with the error boundary you get the react component stack attached to your error. Sentry also makes this part of the exception object, so they will get sourcemapped!
Here's a example from the Sentry codebase. The main stacktrace:
and then the stacktrace from the component stack that represents the component chain to the component that threw the error
This extra context is useful when trying to figure out what HOC/parent components were involved when rendering the component that threw the error.