Add error in plugins context

This commit is contained in:
Sebastien Chopin 2017-06-09 13:44:07 +02:00
parent e4e5096ee2
commit 92951853fc

View File

@ -103,8 +103,9 @@ async function createApp (ssrContext) {
if (typeof err === 'string') {
err = { statusCode: 500, message: err }
}
this.$options._nuxt.dateErr = Date.now()
this.$options._nuxt.err = err;
const _nuxt = this._nuxt || this.$options._nuxt
_nuxt.dateErr = Date.now()
_nuxt.err = err
return err
}
},
@ -117,11 +118,11 @@ async function createApp (ssrContext) {
isClient: !ssrContext,
route: router.currentRoute,
next,
error: app._nuxt.error.bind(app),
<%= (store ? 'store,' : '') %>
req: ssrContext ? ssrContext.req : undefined,
res: ssrContext ? ssrContext.res : undefined,
}, app)
delete ctx.error
// Inject external plugins
<% plugins.forEach(function (plugin) {