Skip to content

Commit

Permalink
feat(react): Mark errors captured from ErrorBoundary as unhandled (#8914
Browse files Browse the repository at this point in the history
)

For more details see #8890
  • Loading branch information
Lms24 committed Sep 4, 2023
1 parent 86b3c69 commit 3d8b444
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react/src/errorboundary.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReportDialogOptions, Scope } from '@sentry/browser';
import { captureException, getCurrentHub, showReportDialog, withScope } from '@sentry/browser';
import { isError, logger } from '@sentry/utils';
import { addExceptionMechanism, isError, logger } from '@sentry/utils';
import hoistNonReactStatics from 'hoist-non-react-statics';
import * as React from 'react';

Expand Down Expand Up @@ -138,7 +138,14 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
if (beforeCapture) {
beforeCapture(scope, error, componentStack);
}

scope.addEventProcessor(event => {
addExceptionMechanism(event, { handled: false })
return event;
})

const eventId = captureException(error, { contexts: { react: { componentStack } } });

if (onError) {
onError(error, componentStack, eventId);
}
Expand Down

0 comments on commit 3d8b444

Please sign in to comment.