From db7666d0f35c4417fb357162b7cdad89f86d9bee Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Mon, 28 Oct 2019 03:55:50 +0300 Subject: [PATCH] fix(warning): handle errors in warn handler (#396) --- packages/runtime-core/src/warning.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/runtime-core/src/warning.ts b/packages/runtime-core/src/warning.ts index 7ea32b7c..b1ac6f27 100644 --- a/packages/runtime-core/src/warning.ts +++ b/packages/runtime-core/src/warning.ts @@ -2,6 +2,7 @@ import { VNode } from './vnode' import { Data, ComponentInternalInstance, Component } from './component' import { isString, isFunction } from '@vue/shared' import { toRaw } from '@vue/reactivity' +import { callWithErrorHandling, ErrorCodes } from './errorHandling' type ComponentVNode = VNode & { type: Component @@ -30,10 +31,15 @@ export function warn(msg: string, ...args: any[]) { const trace = getComponentTrace() if (appWarnHandler) { - appWarnHandler( - msg + args.join(''), - instance && instance.renderProxy, - formatTrace(trace).join('') + callWithErrorHandling( + appWarnHandler, + instance, + ErrorCodes.APP_WARN_HANDLER, + [ + msg + args.join(''), + instance && instance.renderProxy, + formatTrace(trace).join('') + ] ) return }