Home

Issue: 555

How to throw an error outside asyncData and fetch.

[issue link]

Inspired by the solution posted in #429, I am looking to add error handling for some axios calls.

The code in that solution only throws errors in the browser, so I would like to instead throw a regular nuxt error page. However, the only way I know to do this is using the context.error() function inside asyncData or fetch.

How can I throw an error inside a plugin? Is there a way to get the global context or error handler?

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