From 937ce612c76d9642b2a617cbf1e2420fe3540992 Mon Sep 17 00:00:00 2001 From: Igor Date: Sat, 2 Jun 2018 17:46:57 +0300 Subject: [PATCH] feat(csr): support custom Vue.config.errorHandler (#3337) --- lib/app/client.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 33949f98c2..dcb705efc1 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -37,14 +37,21 @@ Vue.config.errorHandler = function (err, vm, info) { message: err.message || err.toString() } + // Call other handler if exist + let handled = null + if (typeof defaultErrorHandler === 'function') { + handled = defaultErrorHandler(...arguments) + } + if(handled === true){ + return handled + } + // Show Nuxt Error Page if(vm && vm.$root && vm.$root.$nuxt && vm.$root.$nuxt.error && info !== 'render function') { vm.$root.$nuxt.error(nuxtError) } - - // Call other handler if exist if (typeof defaultErrorHandler === 'function') { - return defaultErrorHandler(...arguments) + return handled } // Log to console