Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce46ffc

Browse files
authored
ref(vue): Adjust mechanism in Vue error handler (#17647)
Event mechanism type now follows the trace origin naming scheme closes #17640
1 parent 566929b commit ce46ffc

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- ref(remix): Adjust event mechanism of `captureRemixServerException` ([#17629](https://github.com/getsentry/sentry-javascript/pull/17629))
3232
- ref(replay-internal): Add mechanism to error caught by `replayIntegration` in debug mode ([#17606](https://github.com/getsentry/sentry-javascript/pull/17606))
3333
- ref(solid): Add `mechanism` to error captured by `withSentryErrorBoundary` ([#17607](https://github.com/getsentry/sentry-javascript/pull/17607))
34+
- ref(vue): Adjust mechanism in Vue error handler ([#17647](https://github.com/getsentry/sentry-javascript/pull/17647))
3435

3536
<br/>
3637

‎dev-packages/e2e-tests/test-applications/vue-3/tests/errors.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('sends an error', async ({ page }) => {
1919
type: 'Error',
2020
value: 'This is a Vue test error',
2121
mechanism: {
22-
type: 'vue',
22+
type: 'auto.function.vue.error_handler',
2323
handled: false,
2424
},
2525
},
@@ -47,7 +47,7 @@ test('sends an error with a parameterized transaction name', async ({ page }) =>
4747
type: 'Error',
4848
value: 'This is a Vue test error',
4949
mechanism: {
50-
type: 'vue',
50+
type: 'auto.function.vue.error_handler',
5151
handled: false,
5252
},
5353
},

‎packages/vue/src/errorhandler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const attachErrorHandler = (app: Vue, options: VueOptions): void => {
3030
setTimeout(() => {
3131
captureException(error, {
3232
captureContext: { contexts: { vue: metadata } },
33-
mechanism: { handled: !!originalErrorHandler, type: 'vue' },
33+
mechanism: { handled: !!originalErrorHandler, type: 'auto.function.vue.error_handler' },
3434
});
3535
});
3636

‎packages/vue/test/errorHandler.test.ts‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ describe('attachErrorHandler', () => {
2626

2727
// assert
2828
t.expect.errorToHaveBeenCaptured().withoutProps();
29-
t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' });
29+
t.expect
30+
.errorToHaveBeenCaptured()
31+
.withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' });
3032
});
3133
});
3234

@@ -47,7 +49,9 @@ describe('attachErrorHandler', () => {
4749

4850
// assert
4951
t.expect.errorToHaveBeenCaptured().withoutProps();
50-
t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' });
52+
t.expect
53+
.errorToHaveBeenCaptured()
54+
.withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' });
5155
});
5256
});
5357

@@ -146,7 +150,9 @@ describe('attachErrorHandler', () => {
146150
vi.runAllTimers();
147151

148152
// assert
149-
t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: false, type: 'vue' });
153+
t.expect
154+
.errorToHaveBeenCaptured()
155+
.withMechanismMetadata({ handled: false, type: 'auto.function.vue.error_handler' });
150156
});
151157

152158
it('should mark error as handled and properly delegate to error handler', () => {
@@ -167,7 +173,9 @@ describe('attachErrorHandler', () => {
167173

168174
// assert
169175
t.expect.errorHandlerSpy.toHaveBeenCalledWith(expect.any(Error), vm, 'stub-lifecycle-hook');
170-
t.expect.errorToHaveBeenCaptured().withMechanismMetadata({ handled: true, type: 'vue' });
176+
t.expect
177+
.errorToHaveBeenCaptured()
178+
.withMechanismMetadata({ handled: true, type: 'auto.function.vue.error_handler' });
171179
});
172180
});
173181
});
@@ -305,7 +313,7 @@ const testHarness = ({
305313
withoutProps: () => {
306314
expect(contexts).not.toHaveProperty('vue.propsData');
307315
},
308-
withMechanismMetadata: (mechanism: { handled: boolean; type: 'vue' }) => {
316+
withMechanismMetadata: (mechanism: { handled: boolean; type: 'auto.function.vue.error_handler' }) => {
309317
expect(mechanismMetadata).toEqual(mechanism);
310318
},
311319
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /