Skip to content

Commit 726a6ad

Browse files
authored
feat(browser): Mark errors caught from TryCatch integration as unhandled (#8890)
Change the mechanisms of errors caught from the `TryCatch` integration to report the error as unhandled. Detailed write-up in #8890
1 parent 61450cb commit 726a6ad

File tree

4 files changed

+11
-11
lines changed
  • packages

4 files changed

+11
-11
lines changed

packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sentryTest(
1717
value: 'event_listener_error',
1818
mechanism: {
1919
type: 'instrument',
20-
handled: true,
20+
handled: false,
2121
},
2222
stacktrace: {
2323
frames: expect.any(Array),

packages/browser-integration-tests/suites/sessions/update-session/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sentryTest('should update session when an error is thrown.', async ({ getLocalTe
1717
expect(updatedSession).toBeDefined();
1818
expect(updatedSession.init).toBe(false);
1919
expect(updatedSession.errors).toBe(1);
20-
expect(updatedSession.status).toBe('ok');
20+
expect(updatedSession.status).toBe('crashed');
2121
expect(pageloadSession.sid).toBe(updatedSession.sid);
2222
});
2323

packages/browser/src/integrations/trycatch.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function _wrapTimeFunction(original: () => void): () => number {
113113
args[0] = wrap(originalCallback, {
114114
mechanism: {
115115
data: { function: getFunctionName(original) },
116-
handled: true,
116+
handled: false,
117117
type: 'instrument',
118118
},
119119
});
@@ -134,7 +134,7 @@ function _wrapRAF(original: any): (callback: () => void) => any {
134134
function: 'requestAnimationFrame',
135135
handler: getFunctionName(original),
136136
},
137-
handled: true,
137+
handled: false,
138138
type: 'instrument',
139139
},
140140
}),
@@ -160,7 +160,7 @@ function _wrapXHR(originalSend: () => void): () => void {
160160
function: prop,
161161
handler: getFunctionName(original),
162162
},
163-
handled: true,
163+
handled: false,
164164
type: 'instrument',
165165
},
166166
};
@@ -220,7 +220,7 @@ function _wrapEventTarget(target: string): void {
220220
handler: getFunctionName(fn),
221221
target,
222222
},
223-
handled: true,
223+
handled: false,
224224
type: 'instrument',
225225
},
226226
});
@@ -239,7 +239,7 @@ function _wrapEventTarget(target: string): void {
239239
handler: getFunctionName(fn),
240240
target,
241241
},
242-
handled: true,
242+
handled: false,
243243
type: 'instrument',
244244
},
245245
}),

packages/browser/test/integration/suites/builtins.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('wrapped built-ins', function () {
182182

183183
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
184184
type: 'instrument',
185-
handled: true,
185+
handled: false,
186186
data: {
187187
function: 'onreadystatechange',
188188
},
@@ -237,7 +237,7 @@ describe('wrapped built-ins', function () {
237237

238238
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
239239
type: 'instrument',
240-
handled: true,
240+
handled: false,
241241
});
242242
}
243243
});
@@ -277,7 +277,7 @@ describe('wrapped built-ins', function () {
277277
assert.oneOf(target, ['Node', 'EventTarget']);
278278
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
279279
type: 'instrument',
280-
handled: true,
280+
handled: false,
281281
data: {
282282
function: 'addEventListener',
283283
},
@@ -313,7 +313,7 @@ describe('wrapped built-ins', function () {
313313
assert.oneOf(target, ['Node', 'EventTarget']);
314314
assert.deepEqual(summary.events[0].exception.values[0].mechanism, {
315315
type: 'instrument',
316-
handled: true,
316+
handled: false,
317317
data: {
318318
function: 'addEventListener',
319319
handler: '<anonymous>',

0 commit comments

Comments
 (0)