mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
feat(csr): support custom Vue.config.errorHandler (#3337)
This commit is contained in:
parent
0db21b1f54
commit
937ce612c7
@ -37,14 +37,21 @@ Vue.config.errorHandler = function (err, vm, info) {
|
|||||||
message: err.message || err.toString()
|
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
|
// Show Nuxt Error Page
|
||||||
if(vm && vm.$root && vm.$root.$nuxt && vm.$root.$nuxt.error && info !== 'render function') {
|
if(vm && vm.$root && vm.$root.$nuxt && vm.$root.$nuxt.error && info !== 'render function') {
|
||||||
vm.$root.$nuxt.error(nuxtError)
|
vm.$root.$nuxt.error(nuxtError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call other handler if exist
|
|
||||||
if (typeof defaultErrorHandler === 'function') {
|
if (typeof defaultErrorHandler === 'function') {
|
||||||
return defaultErrorHandler(...arguments)
|
return handled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log to console
|
// Log to console
|
||||||
|
Loading…
Reference in New Issue
Block a user