From 6b6aa3e392b4e82ca7d2418a8c8ad99050ee47c8 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Fri, 10 Nov 2017 14:04:43 +0800 Subject: [PATCH] refactor: log nuxtServerInit error for better error tracing --- lib/app/server.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/app/server.js b/lib/app/server.js index df23de17c2..6568b97f49 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -91,7 +91,12 @@ export default async ssrContext => { ** Dispatch store nuxtServerInit */ if (store._actions && store._actions.nuxtServerInit) { - await store.dispatch('nuxtServerInit', app.context) + try { + await store.dispatch('nuxtServerInit', app.context) + } catch (err) { + debug('error occurred when calling nuxtServerInit: ', e.message) + throw err + } } // ...If there is a redirect or an error, stop the process if (ssrContext.redirected) return noopApp()