Home

Issue: 134

[Enhancement] Handle data() promise errors

[issue link]

If any error occurs inside component’s data() an ugly and unhanded SSR error occurs like this:

TypeError: Converting circular structure to JSON
image

Also trying to handle errors in every single page seems so extra work and not possible always consider my dashboard’s data :

async data({redirect, error}){
            try {
                let {stats} = await $http.get('admin/dashboard');
                return { stats: stats }
            } catch {
                 error({message:'Something bad happened!'}); 
                 return {stats: {} }
            }
        },

Suggestion: Why we don’t simply catch all returned promises in data and passing proper error object to user land?

This feature request is available on Nuxt.js community (#c112)