Skip to content

Commit a67eee2

Browse files
committed
catch computed evaluation errors
1 parent f5bc7fa commit a67eee2

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/backend/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,20 @@ function processState (instance) {
400400

401401
function processComputed (instance) {
402402
return Object.keys(instance.$options.computed || {}).map(key => {
403-
return {
404-
type: 'computed',
405-
key,
406-
value: instance[key]
403+
// use try ... catch here because some computed properties may
404+
// throw error during its evaluation
405+
try {
406+
return {
407+
type: 'computed',
408+
key,
409+
value: instance[key]
410+
}
411+
} catch (e) {
412+
return {
413+
type: 'computed',
414+
key,
415+
value: '(error during evaluation)'
416+
}
407417
}
408418
})
409419
}

src/devtools/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import VuexTab from './views/vuex/VuexTab.vue'
5151
import { mapState } from 'vuex'
5252
5353
export default {
54+
name: 'app',
5455
components: {
5556
components: ComponentsTab,
5657
vuex: VuexTab,

src/devtools/views/events/EventInspector.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export default {
3030
'activeEvent'
3131
]),
3232
sortedEventData () {
33+
if (!this.activeEvent) {
34+
return {}
35+
}
3336
const data = this.isComplex
3437
? this.getSortedEventData()
3538
: this.activeEvent.eventData

0 commit comments

Comments
 (0)