Home

Issue: 2772

How to handle error in nuxtServerInit?

[issue link]
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.

This question is available on Nuxt.js community (#c2406)