From 3d8b44441a32d5fd141454974465e17d30a5492c Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 4 Sep 2023 13:57:56 +0200 Subject: [PATCH] feat(react): Mark errors captured from ErrorBoundary as unhandled (#8914) For more details see #8890 --- packages/react/src/errorboundary.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react/src/errorboundary.tsx b/packages/react/src/errorboundary.tsx index d3c831e24357..3d894fc699a8 100644 --- a/packages/react/src/errorboundary.tsx +++ b/packages/react/src/errorboundary.tsx @@ -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'; @@ -138,7 +138,14 @@ class ErrorBoundary extends React.Component { + addExceptionMechanism(event, { handled: false }) + return event; + }) + const eventId = captureException(error, { contexts: { react: { componentStack } } }); + if (onError) { onError(error, componentStack, eventId); }