refactor: improve scheduler error warning message
This commit is contained in:
parent
665ff43fad
commit
45e9a42a1a
@ -21,20 +21,21 @@ export const enum ErrorTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ErrorTypeStrings: Record<number, string> = {
|
const ErrorTypeStrings: Record<number, string> = {
|
||||||
[ErrorTypes.BEFORE_CREATE]: 'beforeCreate lifecycle hook',
|
[ErrorTypes.BEFORE_CREATE]: 'in beforeCreate lifecycle hook',
|
||||||
[ErrorTypes.CREATED]: 'created lifecycle hook',
|
[ErrorTypes.CREATED]: 'in created lifecycle hook',
|
||||||
[ErrorTypes.BEFORE_MOUNT]: 'beforeMount lifecycle hook',
|
[ErrorTypes.BEFORE_MOUNT]: 'in beforeMount lifecycle hook',
|
||||||
[ErrorTypes.MOUNTED]: 'mounted lifecycle hook',
|
[ErrorTypes.MOUNTED]: 'in mounted lifecycle hook',
|
||||||
[ErrorTypes.BEFORE_UPDATE]: 'beforeUpdate lifecycle hook',
|
[ErrorTypes.BEFORE_UPDATE]: 'in beforeUpdate lifecycle hook',
|
||||||
[ErrorTypes.UPDATED]: 'updated lifecycle hook',
|
[ErrorTypes.UPDATED]: 'in updated lifecycle hook',
|
||||||
[ErrorTypes.BEFORE_DESTROY]: 'beforeDestroy lifecycle hook',
|
[ErrorTypes.BEFORE_DESTROY]: 'in beforeDestroy lifecycle hook',
|
||||||
[ErrorTypes.DESTROYED]: 'destroyed lifecycle hook',
|
[ErrorTypes.DESTROYED]: 'in destroyed lifecycle hook',
|
||||||
[ErrorTypes.ERROR_CAPTURED]: 'errorCaptured lifecycle hook',
|
[ErrorTypes.ERROR_CAPTURED]: 'in errorCaptured lifecycle hook',
|
||||||
[ErrorTypes.RENDER]: 'render function',
|
[ErrorTypes.RENDER]: 'in render function',
|
||||||
[ErrorTypes.WATCH_CALLBACK]: 'watcher callback',
|
[ErrorTypes.WATCH_CALLBACK]: 'in watcher callback',
|
||||||
[ErrorTypes.NATIVE_EVENT_HANDLER]: 'native event handler',
|
[ErrorTypes.NATIVE_EVENT_HANDLER]: 'in native event handler',
|
||||||
[ErrorTypes.COMPONENT_EVENT_HANDLER]: 'component event handler',
|
[ErrorTypes.COMPONENT_EVENT_HANDLER]: 'in component event handler',
|
||||||
[ErrorTypes.SCHEDULER]: 'scheduler'
|
[ErrorTypes.SCHEDULER]:
|
||||||
|
'when flushing updates. This may be a Vue internals bug.'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleError(
|
export function handleError(
|
||||||
@ -84,7 +85,7 @@ function logError(err: Error, type: ErrorTypes, contextVNode: VNode | null) {
|
|||||||
if (contextVNode) {
|
if (contextVNode) {
|
||||||
pushWarningContext(contextVNode)
|
pushWarningContext(contextVNode)
|
||||||
}
|
}
|
||||||
warn(`Unhandled error${info ? ` in ${info}` : ``}`)
|
warn(`Unhandled error${info ? ` ${info}` : ``}`)
|
||||||
if (contextVNode) {
|
if (contextVNode) {
|
||||||
popWarningContext()
|
popWarningContext()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user