File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ export const onBeforeUpdate = createLifeCycle('beforeUpdate')
4242export const onUpdated = createLifeCycle ( 'updated' )
4343export const onBeforeUnmount = createLifeCycle ( 'beforeDestroy' )
4444export const onUnmounted = createLifeCycle ( 'destroyed' )
45- export const onErrorCaptured = createLifeCycle ( 'errorCaptured' )
4645export const onActivated = createLifeCycle ( 'activated' )
4746export const onDeactivated = createLifeCycle ( 'deactivated' )
4847export const onServerPrefetch = createLifeCycle ( 'serverPrefetch' )
@@ -51,3 +50,19 @@ export const onRenderTracked =
5150 createLifeCycle < ( e : DebuggerEvent ) => any > ( 'renderTracked' )
5251export const onRenderTriggered =
5352 createLifeCycle < ( e : DebuggerEvent ) => any > ( 'renderTriggered' )
53+
54+ export type ErrorCapturedHook < TError = unknown > = (
55+ err : TError ,
56+ instance : any ,
57+ info : string
58+ ) => boolean | void
59+
60+ const injectErrorCapturedHook =
61+ createLifeCycle < ErrorCapturedHook < any > > ( 'errorCaptured' )
62+
63+ export function onErrorCaptured < TError = Error > (
64+ hook : ErrorCapturedHook < TError > ,
65+ target : any = currentInstance
66+ ) {
67+ injectErrorCapturedHook ( hook , target )
68+ }
You can’t perform that action at this time.
0 commit comments