feat: error handling for setup / render / watch / event handlers

This commit is contained in:
Evan You
2019-08-30 15:05:39 -04:00
parent 1d55b368e8
commit 966d7b5487
11 changed files with 219 additions and 72 deletions

View File

@@ -4,7 +4,7 @@ import {
currentInstance,
setCurrentInstance
} from './component'
import { callUserFnWithErrorHandling, ErrorTypeStrings } from './errorHandling'
import { callWithAsyncErrorHandling, ErrorTypeStrings } from './errorHandling'
import { warn } from './warning'
import { capitalize } from '@vue/shared'
@@ -19,7 +19,7 @@ function injectHook(
// This assumes the hook does not synchronously trigger other hooks, which
// can only be false when the user does something really funky.
setCurrentInstance(target)
const res = callUserFnWithErrorHandling(hook, target, type, args)
const res = callWithAsyncErrorHandling(hook, target, type, args)
setCurrentInstance(null)
return res
})