Skip to content
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

feat(browser): Mark errors caught from TryCatch as unhandled #8890

Merged
merged 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sentryTest(
value: 'event_listener_error',
mechanism: {
type: 'instrument',
handled: true,
handled: false,
},
stacktrace: {
frames: expect.any(Array),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sentryTest('should update session when an error is thrown.', async ({ getLocalTe
expect(updatedSession).toBeDefined();
expect(updatedSession.init).toBe(false);
expect(updatedSession.errors).toBe(1);
expect(updatedSession.status).toBe('ok');
expect(updatedSession.status).toBe('crashed');
expect(pageloadSession.sid).toBe(updatedSession.sid);
});

Expand Down
10 changes: 5 additions & 5 deletions packages/browser/src/integrations/trycatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function _wrapTimeFunction(original: () => void): () => number {
args[0] = wrap(originalCallback, {
mechanism: {
data: { function: getFunctionName(original) },
handled: true,
handled: false,
type: 'instrument',
},
});
Expand All @@ -134,7 +134,7 @@ function _wrapRAF(original: any): (callback: () => void) => any {
function: 'requestAnimationFrame',
handler: getFunctionName(original),
},
handled: true,
handled: false,
type: 'instrument',
},
}),
Expand All @@ -160,7 +160,7 @@ function _wrapXHR(originalSend: () => void): () => void {
function: prop,
handler: getFunctionName(original),
},
handled: true,
handled: false,
type: 'instrument',
},
};
Expand Down Expand Up @@ -220,7 +220,7 @@ function _wrapEventTarget(target: string): void {
handler: getFunctionName(fn),
target,
},
handled: true,
handled: false,
type: 'instrument',
},
});
Expand All @@ -239,7 +239,7 @@ function _wrapEventTarget(target: string): void {
handler: getFunctionName(fn),
target,
},
handled: true,
handled: false,
type: 'instrument',
},
}),
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/test/integration/suites/builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe('wrapped built-ins', function () {

assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
type: 'instrument',
handled: true,
handled: false,
data: {
function: 'onreadystatechange',
},
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('wrapped built-ins', function () {

assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
type: 'instrument',
handled: true,
handled: false,
});
}
});
Expand Down Expand Up @@ -277,7 +277,7 @@ describe('wrapped built-ins', function () {
assert.oneOf(target, ['Node', 'EventTarget']);
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
type: 'instrument',
handled: true,
handled: false,
data: {
function: 'addEventListener',
},
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('wrapped built-ins', function () {
assert.oneOf(target, ['Node', 'EventTarget']);
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
type: 'instrument',
handled: true,
handled: false,
data: {
function: 'addEventListener',
handler: '<anonymous>',
Expand Down