Static GitHub Issues

[786] how to trigger error.vue (from layouts) with self made error ?

prev: Error: store/index.js should export a method which returns a Vuex instance
next: How to write nested layout?

hi,

The error.vue page (layouts directory) is triggered to errors coming from the back or front-end.

I am trying to trigger this error.vue page to an Error that I throw myself from the store. Here is the code extracted from the action I am testing :

// One action of the Store
new_error_message({error_message}){
function NewError(error_message) {
      this.name = 'NewError'
      this.message = error_message || 'Error happened'
      this.stack = (new Error()).stack
    }
    NewError.prototype = Object.create(Error.prototype)
    NewError.prototype.constructor = NewError

 throw new NewError()
}

Once thrown, this Error is seen in the console but it does not trigger the error.vue page.
What should I do to trigger these self made errors ?

Help will be much appreciated :-)

Matthieu

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c670">#c670</a>)</em></sub></div>