Skip to content

Commit 39401f0

Browse files
authored
feat(remix): Mark errors caught from Remix instrumentation as unhandled (#8894)
Mark errors caught from remix instrumentation as unhandled: * `captureRemixErrorBoundaryError` * `captureRemixServerException` For more details see #8890, #6073
1 parent b102817 commit 39401f0

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

packages/remix/src/client/errors.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function captureRemixErrorBoundaryError(error: unknown): void {
4343
scope.addEventProcessor(event => {
4444
addExceptionMechanism(event, {
4545
type: 'instrument',
46-
handled: true,
46+
handled: false,
4747
data: eventData,
4848
});
4949
return event;

packages/remix/src/utils/instrumentServer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export async function captureRemixServerException(err: unknown, name: string, re
104104
scope.addEventProcessor(event => {
105105
addExceptionMechanism(event, {
106106
type: 'instrument',
107-
handled: true,
107+
handled: false,
108108
data: {
109109
function: name,
110110
},

packages/remix/test/integration/test/client/errorboundary.test.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('should capture React component errors.', async ({ page }) => {
1111

1212
const [pageloadEnvelope, errorEnvelope] = envelopes;
1313

14-
expect(pageloadEnvelope.contexts?.trace.op).toBe('pageload');
14+
expect(pageloadEnvelope.contexts?.trace?.op).toBe('pageload');
1515
expect(pageloadEnvelope.tags?.['routing.instrumentation']).toBe('remix-router');
1616
expect(pageloadEnvelope.type).toBe('transaction');
1717
expect(pageloadEnvelope.transaction).toBe(
@@ -27,14 +27,17 @@ test('should capture React component errors.', async ({ page }) => {
2727
type: 'React ErrorBoundary Error',
2828
value: 'Sentry React Component Error',
2929
stacktrace: { frames: expect.any(Array) },
30+
mechanism: { type: 'chained', handled: false },
3031
},
3132
]
3233
: []),
3334
{
3435
type: 'Error',
3536
value: 'Sentry React Component Error',
3637
stacktrace: { frames: expect.any(Array) },
37-
mechanism: { type: useV2 ? 'instrument' : 'generic', handled: true },
38+
// In v2 this error will be marked unhandled, in v1 its handled because of LinkedErrors
39+
// This should be fine though because the error boundary's error is marked unhandled
40+
mechanism: { type: useV2 ? 'instrument' : 'generic', handled: !useV2 },
3841
},
3942
]);
4043
});

packages/remix/test/integration/test/server/action.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
8383
data: {
8484
function: useV2 ? 'remix.server' : 'action',
8585
},
86-
handled: true,
86+
handled: false,
8787
type: 'instrument',
8888
},
8989
},
@@ -203,7 +203,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
203203
data: {
204204
function: useV2 ? 'remix.server' : 'loader',
205205
},
206-
handled: true,
206+
handled: false,
207207
type: 'instrument',
208208
},
209209
},
@@ -256,7 +256,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
256256
data: {
257257
function: useV2 ? 'ErrorResponse' : 'action',
258258
},
259-
handled: true,
259+
handled: false,
260260
type: 'instrument',
261261
},
262262
},
@@ -311,7 +311,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
311311
data: {
312312
function: useV2 ? 'ErrorResponse' : 'action',
313313
},
314-
handled: true,
314+
handled: false,
315315
type: 'instrument',
316316
},
317317
},
@@ -364,7 +364,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
364364
data: {
365365
function: useV2 ? 'ErrorResponse' : 'action',
366366
},
367-
handled: true,
367+
handled: false,
368368
type: 'instrument',
369369
},
370370
},
@@ -419,7 +419,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
419419
data: {
420420
function: useV2 ? 'ErrorResponse' : 'action',
421421
},
422-
handled: true,
422+
handled: false,
423423
type: 'instrument',
424424
},
425425
},

packages/remix/test/integration/test/server/loader.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
4141
data: {
4242
function: useV2 ? 'remix.server' : 'loader',
4343
},
44-
handled: true,
44+
handled: false,
4545
type: 'instrument',
4646
},
4747
},
@@ -140,7 +140,7 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
140140
data: {
141141
function: useV2 ? 'remix.server' : 'loader',
142142
},
143-
handled: true,
143+
handled: false,
144144
type: 'instrument',
145145
},
146146
},

0 commit comments

Comments
 (0)