]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(warning): handle errors in warn handler (#396)
authorDmitry Sharshakov <d3dx12.xx@gmail.com>
Mon, 28 Oct 2019 00:55:50 +0000 (03:55 +0300)
committerEvan You <yyx990803@gmail.com>
Mon, 28 Oct 2019 00:55:50 +0000 (20:55 -0400)
packages/runtime-core/src/warning.ts

index 7ea32b7cd46f4e61273afccf2fb389fa143d84ff..b1ac6f2716c4032c55263293fc6f6c6e679cc7fb 100644 (file)
@@ -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
   }