Static GitHub Issues

[2501] error() not handled on server side in event

prev: Nuxt + Charjs Help needed
next: Bug while back from error page.

Hi,

I tried handle error() from an event handler in plugin/middleware. On client-side error() from event was handled, but on server-side not.

my plugin

export default ({ app, req, error }, inject) => {
  // ...
  api.client.on('error', err => {
    console.log(err)
    error({ statusCode: 503, message: err.message })
  })
}

I tried this code in middleware and has take the same effect.

Event is emitted from Promise for general Promise error handling from my service

If i handle error() outside of event handler, then all works ok on server and client.

export default ({ app, req, error }) => {
 error({ statusCode: 503, message: 'error' })
}

It's a bug, or I doing something wrong? Thanks

Nuxt version: 1.0.0-rc11 Node version: v8.9.1 Browser Google Chrome 61.0.3163.100 x_64 OS: Linux ellen-wrk 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

<!--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/c2171">#c2171</a>)</em></sub></div>