mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
feat(app): enable global vue error handler only in dev
With production builds, some Vue warns are being changed to errors this may lead to unwanted error pages.
This commit is contained in:
parent
f23a6d34a4
commit
400363860a
@ -31,11 +31,12 @@ let router
|
||||
const NUXT = window.__NUXT__ || {}
|
||||
NUXT.components = window.__COMPONENTS__ || null
|
||||
|
||||
<% if (debug) { %>
|
||||
// Setup global Vue error handler
|
||||
const defaultErrorHandler = Vue.config.errorHandler
|
||||
Vue.config.errorHandler = function (err, vm, info) {
|
||||
err.statusCode = err.statusCode || 'Whoops!'
|
||||
|
||||
|
||||
// Show Nuxt Error Page
|
||||
if(vm && vm.$root && vm.$root.$nuxt) {
|
||||
vm.$root.$nuxt.error(err)
|
||||
@ -52,6 +53,7 @@ Vue.config.errorHandler = function (err, vm, info) {
|
||||
}
|
||||
console.error(err);
|
||||
}
|
||||
<% } %>
|
||||
|
||||
// Create and mount App
|
||||
createApp()
|
||||
|
Loading…
Reference in New Issue
Block a user