diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f6f1ceb6de2..b470228dcc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - ref(remix): Adjust event mechanism of `captureRemixServerException` ([#17629](https://github.com/getsentry/sentry-javascript/pull/17629)) - ref(replay-internal): Add mechanism to error caught by `replayIntegration` in debug mode ([#17606](https://github.com/getsentry/sentry-javascript/pull/17606)) - ref(solid): Add `mechanism` to error captured by `withSentryErrorBoundary` ([#17607](https://github.com/getsentry/sentry-javascript/pull/17607)) + - ref(vue): Adjust mechanism in Vue error handler ([#17647](https://github.com/getsentry/sentry-javascript/pull/17647))
diff --git a/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts index b86e56eb4b83..118476aeb485 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts +++ b/dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts @@ -19,7 +19,7 @@ test('sends an error', async ({ page }) => { type: 'Error', value: 'This is a Vue test error', mechanism: { - type: 'vue', + type: 'auto.function.vue.error_handler', handled: false, }, }, @@ -47,7 +47,7 @@ test('sends an error with a parameterized transaction name', async ({ page }) => type: 'Error', value: 'This is a Vue test error', mechanism: { - type: 'vue', + type: 'auto.function.vue.error_handler', handled: false, }, }, diff --git a/packages/vue/src/errorhandler.ts b/packages/vue/src/errorhandler.ts index f8ca3b9a2c9f..c18a51492c4a 100644 --- a/packages/vue/src/errorhandler.ts +++ b/packages/vue/src/errorhandler.ts @@ -30,7 +30,7 @@ export const attachErrorHandler = (app: Vue, options: VueOptions): void => { setTimeout(() => { captureException(error, { captureContext: { contexts: { vue: metadata } }, - mechanism: { handled: !!originalErrorHandler, type: 'vue' }, + mechanism: { handled: !!originalErrorHandler, type: 'auto.function.vue.error_handler' }, }); }); diff --git a/packages/vue/test/errorHandler.test.ts b/packages/vue/test/errorHandler.test.ts index 9e8e7572ba54..54fd80133017 100644 --- a/packages/vue/test/errorHandler.test.ts +++ b/packages/vue/test/errorHandler.test.ts @@ -26,7 +26,9 @@ describe('attachErrorHandler', () => { // assert t.expect.errorToHaveBeenCaptured().withoutProps(); - t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' }); + t.expect + .errorToHaveBeenCaptured() + .withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' }); }); }); @@ -47,7 +49,9 @@ describe('attachErrorHandler', () => { // assert t.expect.errorToHaveBeenCaptured().withoutProps(); - t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' }); + t.expect + .errorToHaveBeenCaptured() + .withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' }); }); }); @@ -146,7 +150,9 @@ describe('attachErrorHandler', () => { vi.runAllTimers(); // assert - t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' }); + t.expect + .errorToHaveBeenCaptured() + .withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' }); }); it('should mark error as handled and properly delegate to error handler', () => { @@ -167,7 +173,9 @@ describe('attachErrorHandler', () => { // assert t.expect.errorHandlerSpy.toHaveBeenCalledWith(expect.any(Error), vm, 'stub-lifecycle-hook'); - t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: true, type: 'vue' }); + t.expect + .errorToHaveBeenCaptured() + .withMechanismMetadata({ handled: true, type: 'auto.function.vue.error_handler' }); }); }); }); @@ -305,7 +313,7 @@ const testHarness = ({ withoutProps: () => { expect(contexts).not.toHaveProperty('vue.propsData'); }, - withMechanismMetadata: (mechanism: { handled: boolean; type: 'vue' }) => { + withMechanismMetadata: (mechanism: { handled: boolean; type: 'auto.function.vue.error_handler' }) => { expect(mechanismMetadata).toEqual(mechanism); }, };