mirror of https://github.com/vuejs/core.git
feat(runtime-vapor): add app-level error handler (#160)
Co-authored-by: Kevin Deng 三咲智子 <sxzz@sxzz.moe>
This commit is contained in:
parent
5c9a15140d
commit
bd888b9b1e
|
@ -7,7 +7,11 @@ import type { ComponentInternalInstance } from './component'
|
||||||
import { isFunction, isPromise } from '@vue/shared'
|
import { isFunction, isPromise } from '@vue/shared'
|
||||||
import { warn } from './warning'
|
import { warn } from './warning'
|
||||||
import { VaporLifecycleHooks } from './apiLifecycle'
|
import { VaporLifecycleHooks } from './apiLifecycle'
|
||||||
import { BaseWatchErrorCodes } from '@vue/reactivity'
|
import {
|
||||||
|
BaseWatchErrorCodes,
|
||||||
|
pauseTracking,
|
||||||
|
resetTracking,
|
||||||
|
} from '@vue/reactivity'
|
||||||
|
|
||||||
// contexts where user provided function may be executed, in addition to
|
// contexts where user provided function may be executed, in addition to
|
||||||
// lifecycle hooks.
|
// lifecycle hooks.
|
||||||
|
@ -131,18 +135,19 @@ export function handleError(
|
||||||
cur = cur.parent
|
cur = cur.parent
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: need appContext interface
|
|
||||||
// app-level handling
|
// app-level handling
|
||||||
// const appErrorHandler = instance.appContext?.config.errorHandler
|
const appErrorHandler = instance.appContext.config.errorHandler
|
||||||
// if (appErrorHandler) {
|
if (appErrorHandler) {
|
||||||
// callWithErrorHandling(
|
pauseTracking()
|
||||||
// appErrorHandler,
|
callWithErrorHandling(
|
||||||
// null,
|
appErrorHandler,
|
||||||
// ErrorCodes.APP_ERROR_HANDLER,
|
null,
|
||||||
// [err, exposedInstance, errorInfo],
|
VaporErrorCodes.APP_ERROR_HANDLER,
|
||||||
// )
|
[err, instance, errorInfo],
|
||||||
// return
|
)
|
||||||
// }
|
resetTracking()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logError(err, type, throwInDev)
|
logError(err, type, throwInDev)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue