Skip to content

feat(remix): Mark errors caught from Remix instrumentation as unhandled #8894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/remix/src/client/errors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function captureRemixErrorBoundaryError(error: unknown): void {
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'instrument',
handled: true,
handled: false,
data: eventData,
});
return event;
Expand Down
2 changes: 1 addition & 1 deletion packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function captureRemixServerException(err: unknown, name: string, re
scope.addEventProcessor(event => {
addExceptionMechanism(event, {
type: 'instrument',
handled: true,
handled: false,
data: {
function: name,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('should capture React component errors.', async ({ page }) => {

const [pageloadEnvelope, errorEnvelope] = envelopes;

expect(pageloadEnvelope.contexts?.trace.op).toBe('pageload');
expect(pageloadEnvelope.contexts?.trace?.op).toBe('pageload');
expect(pageloadEnvelope.tags?.['routing.instrumentation']).toBe('remix-router');
expect(pageloadEnvelope.type).toBe('transaction');
expect(pageloadEnvelope.transaction).toBe(
Expand All @@ -27,14 +27,17 @@ test('should capture React component errors.', async ({ page }) => {
type: 'React ErrorBoundary Error',
value: 'Sentry React Component Error',
stacktrace: { frames: expect.any(Array) },
mechanism: { type: 'chained', handled: false },
},
]
: []),
{
type: 'Error',
value: 'Sentry React Component Error',
stacktrace: { frames: expect.any(Array) },
mechanism: { type: useV2 ? 'instrument' : 'generic', handled: true },
// In v2 this error will be marked unhandled, in v1 its handled because of LinkedErrors
// This should be fine though because the error boundary's error is marked unhandled
mechanism: { type: useV2 ? 'instrument' : 'generic', handled: !useV2 },
},
]);
});
12 changes: 6 additions & 6 deletions packages/remix/test/integration/test/server/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'remix.server' : 'action',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -203,7 +203,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'remix.server' : 'loader',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -256,7 +256,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'ErrorResponse' : 'action',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -311,7 +311,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'ErrorResponse' : 'action',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -364,7 +364,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'ErrorResponse' : 'action',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -419,7 +419,7 @@ describe.each(['builtin', 'express'])('Remix API Actions with adapter = %s', ada
data: {
function: useV2 ? 'ErrorResponse' : 'action',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/remix/test/integration/test/server/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
data: {
function: useV2 ? 'remix.server' : 'loader',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down Expand Up @@ -140,7 +140,7 @@ describe.each(['builtin', 'express'])('Remix API Loaders with adapter = %s', ada
data: {
function: useV2 ? 'remix.server' : 'loader',
},
handled: true,
handled: false,
type: 'instrument',
},
},
Expand Down