From 92951853fc001a32779d2edcb3fb0a2435d5f220 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Fri, 9 Jun 2017 13:44:07 +0200 Subject: [PATCH] Add error in plugins context --- lib/app/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/app/index.js b/lib/app/index.js index 0b556cdf82..4972dea315 100644 --- a/lib/app/index.js +++ b/lib/app/index.js @@ -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) {