Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

<br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
Expand Down Expand Up @@ -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,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/errorhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
});
});

Expand Down
18 changes: 13 additions & 5 deletions packages/vue/test/errorHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
});
});

Expand All @@ -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' });
});
});

Expand Down Expand Up @@ -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', () => {
Expand All @@ -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' });
});
});
});
Expand Down Expand Up @@ -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);
},
};
Expand Down
Loading