feat(csr): support custom Vue.config.errorHandler (#3337)

This commit is contained in:
Igor 2018-06-02 17:46:57 +03:00 committed by Pooya Parsa
parent 0db21b1f54
commit 937ce612c7

View File

@ -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