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:
Pooya Parsa 2017-08-10 14:12:06 +04:30
parent f23a6d34a4
commit 400363860a

View File

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