Skip to content

Commit 3d8b444

Browse files
authored
feat(react): Mark errors captured from ErrorBoundary as unhandled (#8914)
For more details see #8890
1 parent 86b3c69 commit 3d8b444

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ReportDialogOptions, Scope } from '@sentry/browser';
22
import { captureException, getCurrentHub, showReportDialog, withScope } from '@sentry/browser';
3-
import { isError, logger } from '@sentry/utils';
3+
import { addExceptionMechanism, isError, logger } from '@sentry/utils';
44
import hoistNonReactStatics from 'hoist-non-react-statics';
55
import * as React from 'react';
66

@@ -138,7 +138,14 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
138138
if (beforeCapture) {
139139
beforeCapture(scope, error, componentStack);
140140
}
141+
142+
scope.addEventProcessor(event => {
143+
addExceptionMechanism(event, { handled: false })
144+
return event;
145+
})
146+
141147
const eventId = captureException(error, { contexts: { react: { componentStack } } });
148+
142149
if (onError) {
143150
onError(error, componentStack, eventId);
144151
}

0 commit comments

Comments
 (0)