refactor: log nuxtServerInit error for better error tracing

This commit is contained in:
Clark Du 2017-11-10 14:04:43 +08:00
parent e5017c5e2a
commit 6b6aa3e392
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9

View File

@ -91,7 +91,12 @@ export default async ssrContext => {
** Dispatch store nuxtServerInit ** Dispatch store nuxtServerInit
*/ */
if (store._actions && store._actions.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 there is a redirect or an error, stop the process
if (ssrContext.redirected) return noopApp() if (ssrContext.redirected) return noopApp()