Static GitHub Issues

[964] nuxtServerInit - how to handle errors?

prev: Best practice: Fetching async intial state for Vuex store being used in SSR?
next: ie9 not support find method in store.js

Hi!

I need to initialize store with the data from the remote server. I do it in the nuxtServerInit.

How can I handle error (eg. no connection to the remote server) in the nuxtServerInit?

I ask becouse documentation says that there in no error in the context:

The context is given to nuxtServerInit as the 2nd argument, it is the same as the data or fetch method except that context.redirect() and context.error() are omitted.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c835">#c835</a>)</em></sub></div>