Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 641 Bytes

README.md

File metadata and controls

25 lines (20 loc) · 641 Bytes

Example extend Nuxt error

Use

  • Create exception.js in plugins directory (see exception.js)
  • Add @/plugins/exception into plugins array of nuxt.config.js
  • Use app.$exception function instead of error function in asyncData

Example: pages/index.vue

export default {
    async asyncData({ app }) {
        try {
            const asyncData = {}
            asyncData.posts = await app.$axios.$get('/posts')

            return asyncData
        } catch(e) {
            app.$exception(e)
        }
    }
}

More docs about Nuxt error