diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/event-target/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/event-target/test.ts index c2d0ed42d4f4..084379366c9a 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/event-target/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/event-target/test.ts @@ -13,10 +13,9 @@ sentryTest('should capture target name in mechanism data', async ({ getLocalTest type: 'Error', value: 'event_listener_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, data: { - function: 'addEventListener', handler: 'functionListener', target: 'EventTarget', }, diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts index cee945ec8cdb..ba72afd447d3 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts @@ -13,10 +13,9 @@ sentryTest('should capture built-in handlers fn name in mechanism data', async ( type: 'Error', value: 'event_listener_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, data: { - function: 'addEventListener', handler: 'clickHandler', target: 'EventTarget', }, diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts index cf643d796274..4d7a1b101e0d 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts @@ -13,7 +13,7 @@ sentryTest('should transparently remove event listeners from wrapped functions', type: 'Error', value: 'foo', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts index 9a849fd22b88..c36f5fb73412 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts @@ -15,10 +15,9 @@ sentryTest( type: 'Error', value: 'event_listener_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, data: { - function: 'addEventListener', handler: '', target: 'EventTarget', }, diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts index 02b8771d1785..30565ea48a20 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts @@ -13,7 +13,7 @@ sentryTest('should capture exceptions inside callback', async ({ getLocalTestUrl type: 'Error', value: 'requestAnimationFrame_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.requestAnimationFrame', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts index 02942b276a3a..9be24f4e4e57 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts @@ -13,7 +13,7 @@ sentryTest('Instrumentation should capture errors in setInterval', async ({ getL type: 'Error', value: 'setInterval_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.setInterval', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts index 321a96d7b393..3045f633f8c0 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts @@ -13,11 +13,8 @@ sentryTest('Instrumentation should capture errors in setTimeout', async ({ getLo type: 'Error', value: 'setTimeout_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.setTimeout', handled: false, - data: { - function: 'setTimeout', - }, }, stacktrace: { frames: expect.any(Array), diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts index c4322884cfe6..4c6f9280aee0 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts @@ -25,7 +25,7 @@ sentryTest( type: 'Error', value: 'setTimeout_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.setTimeout', handled: false, }, stacktrace: { diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts index 330c94761854..e91081a71f97 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts @@ -15,11 +15,8 @@ sentryTest( type: 'Error', value: 'xhr_error', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.xhr.onreadystatechange', handled: false, - data: { - function: 'onreadystatechange', - }, }, stacktrace: { frames: expect.any(Array), diff --git a/dev-packages/e2e-tests/test-applications/ember-classic/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/ember-classic/tests/errors.test.ts index 2e836cf8b756..3f4b1f5c099e 100644 --- a/dev-packages/e2e-tests/test-applications/ember-classic/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/ember-classic/tests/errors.test.ts @@ -19,7 +19,7 @@ test('sends an error', async ({ page }) => { type: 'TypeError', value: 'this.nonExistentFunction is not a function', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, }, }, @@ -55,7 +55,7 @@ test('assigns the correct transaction value after a navigation', async ({ page } type: 'TypeError', value: 'this.nonExistentFunction is not a function', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, }, }, diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts index 6e3267eab2ed..d536aa0ab928 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/svelte-5/tests/errors.test.ts @@ -19,7 +19,7 @@ test('sends an error', async ({ page }) => { type: 'Error', value: 'Error thrown from Svelte 5 E2E test app', mechanism: { - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', handled: false, }, }, diff --git a/packages/browser/src/helpers.ts b/packages/browser/src/helpers.ts index 362020a8d845..93c87e1d6161 100644 --- a/packages/browser/src/helpers.ts +++ b/packages/browser/src/helpers.ts @@ -133,6 +133,7 @@ export function wrap( return event; }); + // no need to add a mechanism here, we already add it via an event processor above captureException(ex); }); diff --git a/packages/browser/src/integrations/browserapierrors.ts b/packages/browser/src/integrations/browserapierrors.ts index 6db6d40c67c2..7e94c2bc7167 100644 --- a/packages/browser/src/integrations/browserapierrors.ts +++ b/packages/browser/src/integrations/browserapierrors.ts @@ -108,9 +108,8 @@ function _wrapTimeFunction(original: () => void): () => number { const originalCallback = args[0]; args[0] = wrap(originalCallback, { mechanism: { - data: { function: getFunctionName(original) }, handled: false, - type: 'instrument', + type: `auto.browser.browserapierrors.${getFunctionName(original)}`, }, }); return original.apply(this, args); @@ -123,11 +122,10 @@ function _wrapRAF(original: () => void): (callback: () => void) => unknown { wrap(callback, { mechanism: { data: { - function: 'requestAnimationFrame', handler: getFunctionName(original), }, handled: false, - type: 'instrument', + type: 'auto.browser.browserapierrors.requestAnimationFrame', }, }), ]); @@ -146,11 +144,10 @@ function _wrapXHR(originalSend: () => void): () => void { const wrapOptions = { mechanism: { data: { - function: prop, handler: getFunctionName(original), }, handled: false, - type: 'instrument', + type: `auto.browser.browserapierrors.xhr.${prop}`, }, }; @@ -194,12 +191,11 @@ function _wrapEventTarget(target: string, integrationOptions: BrowserApiErrorsOp fn.handleEvent = wrap(fn.handleEvent, { mechanism: { data: { - function: 'handleEvent', handler: getFunctionName(fn), target, }, handled: false, - type: 'instrument', + type: 'auto.browser.browserapierrors.handleEvent', }, }); } @@ -216,12 +212,11 @@ function _wrapEventTarget(target: string, integrationOptions: BrowserApiErrorsOp wrap(fn, { mechanism: { data: { - function: 'addEventListener', handler: getFunctionName(fn), target, }, handled: false, - type: 'instrument', + type: 'auto.browser.browserapierrors.addEventListener', }, }), options, diff --git a/packages/remix/test/integration/test/client/click-error.test.ts b/packages/remix/test/integration/test/client/click-error.test.ts index c8c70105708f..78573bb9782a 100644 --- a/packages/remix/test/integration/test/client/click-error.test.ts +++ b/packages/remix/test/integration/test/client/click-error.test.ts @@ -20,7 +20,7 @@ test('should report a manually captured message on click with the correct stackt type: 'Error', value: 'ClickError', stacktrace: { frames: expect.any(Array) }, - mechanism: { type: 'instrument', handled: false }, + mechanism: { type: 'auto.browser.browserapierrors.addEventListener', handled: false }, }, ]);