Home

Issue: 786

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

[issue link]

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

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