Skip to content

Commit

Permalink
handle updated Vue error info URL
Browse files Browse the repository at this point in the history
  • Loading branch information
yousif-bugsnag committed Jan 22, 2024
1 parent 3225cf6 commit 3795baf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 3795baf

Please sign in to comment.