Skip to content

Commit 389c5be

Browse files
committed
fix remix
1 parent 62649ef commit 389c5be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
125125
// See: https://github.com/getsentry/sentry-javascript/issues/6167
126126
if (isAtLeastReact17(React.version) && isError(error)) {
127127
const errorBoundaryError = new Error(error.message);
128-
errorBoundaryError.name = `React ErrorBoundary ${errorBoundaryError.name}`;
128+
// Once `errorBoundaryError` is constructed, the only thing we need its constructor for is its name. Since the
129+
// real constructor's `name` property is read-only, we just replace the entire constructor with an object that
130+
// has what we need.
131+
errorBoundaryError.constructor = {
132+
name: `React ErrorBoundary ${errorBoundaryError.name}`,
133+
} as typeof errorBoundaryError.constructor;
129134
errorBoundaryError.stack = componentStack;
130135

131136
// Using the `LinkedErrors` integration to link the errors together.

0 commit comments

Comments
 (0)