Static GitHub Issues

[2772] How to handle error in nuxtServerInit?

prev: Store state not updated by observable mutations
next: Error page use default layout instead of defined layout
async nuxtServerInit ({ commit, state }) {
    let sections = await axios.get(`http://api.example.com/sections`)
    commit('SET_SECTIONS', sections.data)
  }

Is there any way to handle this kind of error? I want to show user error page. Docs says

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/c2406">#c2406</a>)</em></sub></div>