|
|
@@ -94,22 +94,23 @@ export default class Watcher {
|
|
|
pushTarget(this)
|
|
|
let value
|
|
|
const vm = this.vm
|
|
|
- if (this.user) {
|
|
|
- try {
|
|
|
- value = this.getter.call(vm, vm)
|
|
|
- } catch (e) {
|
|
|
+ try {
|
|
|
+ value = this.getter.call(vm, vm)
|
|
|
+ } catch (e) {
|
|
|
+ if (this.user) {
|
|
|
handleError(e, vm, `getter for watcher "${this.expression}"`)
|
|
|
+ } else {
|
|
|
+ throw e
|
|
|
}
|
|
|
- } else {
|
|
|
- value = this.getter.call(vm, vm)
|
|
|
- }
|
|
|
- // "touch" every property so they are all tracked as
|
|
|
- // dependencies for deep watching
|
|
|
- if (this.deep) {
|
|
|
- traverse(value)
|
|
|
+ } finally {
|
|
|
+ // "touch" every property so they are all tracked as
|
|
|
+ // dependencies for deep watching
|
|
|
+ if (this.deep) {
|
|
|
+ traverse(value)
|
|
|
+ }
|
|
|
+ popTarget()
|
|
|
+ this.cleanupDeps()
|
|
|
}
|
|
|
- popTarget()
|
|
|
- this.cleanupDeps()
|
|
|
return value
|
|
|
}
|
|
|
|