mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
Add error in plugins context
This commit is contained in:
parent
e4e5096ee2
commit
92951853fc
@ -103,8 +103,9 @@ async function createApp (ssrContext) {
|
|||||||
if (typeof err === 'string') {
|
if (typeof err === 'string') {
|
||||||
err = { statusCode: 500, message: err }
|
err = { statusCode: 500, message: err }
|
||||||
}
|
}
|
||||||
this.$options._nuxt.dateErr = Date.now()
|
const _nuxt = this._nuxt || this.$options._nuxt
|
||||||
this.$options._nuxt.err = err;
|
_nuxt.dateErr = Date.now()
|
||||||
|
_nuxt.err = err
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -117,11 +118,11 @@ async function createApp (ssrContext) {
|
|||||||
isClient: !ssrContext,
|
isClient: !ssrContext,
|
||||||
route: router.currentRoute,
|
route: router.currentRoute,
|
||||||
next,
|
next,
|
||||||
|
error: app._nuxt.error.bind(app),
|
||||||
<%= (store ? 'store,' : '') %>
|
<%= (store ? 'store,' : '') %>
|
||||||
req: ssrContext ? ssrContext.req : undefined,
|
req: ssrContext ? ssrContext.req : undefined,
|
||||||
res: ssrContext ? ssrContext.res : undefined,
|
res: ssrContext ? ssrContext.res : undefined,
|
||||||
}, app)
|
}, app)
|
||||||
delete ctx.error
|
|
||||||
|
|
||||||
// Inject external plugins
|
// Inject external plugins
|
||||||
<% plugins.forEach(function (plugin) {
|
<% plugins.forEach(function (plugin) {
|
||||||
|
Loading…
Reference in New Issue
Block a user