You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a root component that wraps other children, and I would like to be able to use both beforeCapture (child and parent) but I'm unable to propagate beforeCapture or any method within withErrorBoundary. Is there a way? Thank you.
Only the child withErrorBoundary is catching the error. The parent ignores it.
Alternative
Could this be a solution, if added to every child? This way the children would set the tag and whenever there is an error, the parent would react with withErrorBoundary.
Due to how error boundaries work, the child error boundary will swallow the error from the parent one. This means only one beforeCapture will fire, since only one error boundary will activate componentDidCatch.
Your suggestion for scope.setTag works well to solve this. An alternative path is to extract this out to a common beforeCapture helper that everything relies on.
Due to how error boundaries work, the child error boundary will swallow the error from the parent one. This means only one beforeCapture will fire, since only one error boundary will activate componentDidCatch.
Your suggestion for scope.setTag works well to solve this. An alternative path is to extract this out to a common beforeCapture helper that everything relies on.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/gatsby
SDK Version
7.67.0
Framework Version
@sentry/react
Steps to Reproduce
I have a root component that wraps other children, and I would like to be able to use both
beforeCapture
(child and parent) but I'm unable to propagatebeforeCapture
or any method withinwithErrorBoundary
. Is there a way? Thank you.and
Only the child's
beforeCapture
is working.Expected Result
Both tags should be set: Child and parent.
Actual Result
Only the child withErrorBoundary is catching the error. The parent ignores it.
Alternative
Could this be a solution, if added to every child? This way the children would set the tag and whenever there is an error, the parent would react with withErrorBoundary.
The text was updated successfully, but these errors were encountered: