From 3795baf1f465a09433706fbc7af28131166017f9 Mon Sep 17 00:00:00 2001 From: Yousif Ahmed Date: Mon, 22 Jan 2024 12:54:50 +0000 Subject: [PATCH] handle updated Vue error info URL --- packages/plugin-vue/src/vue.js | 2 +- packages/plugin-vue/test/index.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-vue/src/vue.js b/packages/plugin-vue/src/vue.js index 7687b27e9b..9a66a2245b 100644 --- a/packages/plugin-vue/src/vue.js +++ b/packages/plugin-vue/src/vue.js @@ -7,7 +7,7 @@ module.exports = (app, client) => { // In Vue 3.4+, the info param is a link to the Vue error docs in prod, so we need to extract the error code from it // https://github.com/vuejs/core/pull/9165/commits/c261beab2c0a26e401f2c3d5eae2e4c41de6fe4d - const code = typeof info === 'string' && info.indexOf('-') > 0 ? info.split('-')[1] : info + const code = typeof info === 'string' && info.indexOf('runtime-') > 0 ? info.split('runtime-')[1] : info const errorInfo = ErrorTypeStrings[code] || info event.addMetadata('vue', { diff --git a/packages/plugin-vue/test/index.test.ts b/packages/plugin-vue/test/index.test.ts index 18bc7e6181..6875a4b9f6 100644 --- a/packages/plugin-vue/test/index.test.ts +++ b/packages/plugin-vue/test/index.test.ts @@ -103,7 +103,7 @@ describe('bugsnag vue', () => { })) expect(typeof mockVueApp.config.errorHandler).toBe('function') const errorHandler = mockVueApp.config.errorHandler as unknown as Vue3ErrorHandler - errorHandler(new Error('oops'), { $options: { name: 'MyComponent' } }, 'https://vuejs.org/errors/#runtime-1') + errorHandler(new Error('oops'), { $options: { name: 'MyComponent' } }, 'https://vuejs.org/error-reference/#runtime-1') }) it('tolerates unmappable info paramater', done => {