test: tests for error handling

This commit is contained in:
Evan You
2019-08-30 16:08:10 -04:00
parent d5684e1a9d
commit be28f976af
4 changed files with 329 additions and 11 deletions

View File

@@ -2,7 +2,8 @@ import {
ComponentInstance,
LifecycleHooks,
currentInstance,
setCurrentInstance
setCurrentInstance,
ComponentRenderProxy
} from './component'
import { callWithAsyncErrorHandling, ErrorTypeStrings } from './errorHandling'
import { warn } from './warning'
@@ -92,7 +93,11 @@ export function onRenderTracked(
}
export function onErrorCaptured(
hook: Function,
hook: (
err: Error,
instance: ComponentRenderProxy | null,
info: string
) => boolean | void,
target: ComponentInstance | null = currentInstance
) {
injectHook(LifecycleHooks.ERROR_CAPTURED, hook, target)