If any error occurs inside component's data()
an ugly and unhanded SSR error occurs like this:
TypeError: Converting circular structure to JSON
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?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c112">#c112</a>)</em></sub></div>