Skip to content

Commit

Permalink
fix(react): Add actual error name to boundary error name (#9065)
Browse files Browse the repository at this point in the history
Previously, the error name would always be `React ErrorBoundary Error`,
because `errorBoundaryError.name` refers to the name of the Error object
that was just created.
  • Loading branch information
jorrit committed Sep 21, 2023
1 parent 8001498 commit 1f8de57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react/src/errorboundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
// See: https://github.com/getsentry/sentry-javascript/issues/6167
if (isAtLeastReact17(React.version) && isError(error)) {
const errorBoundaryError = new Error(error.message);
errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;
errorBoundaryError.name = `React ErrorBoundary ${error.name}`;
errorBoundaryError.stack = componentStack;

// Using the `LinkedErrors` integration to link the errors together.
Expand Down

0 comments on commit 1f8de57

Please sign in to comment.