Custom nitro errorHandler, but maintain Nuxt’s error handling.
👋 Is it possible to define a custom eventHandler for nitro, but then still use nuxt’s error handler? We need access to the original event, so using the
error
hook is too "late" because (in prod) we lose the stack trace (https://github.com/nuxt/nuxt/blob/2466af53b0331cdb8b17c2c3b08675c5985deaf3/packages/nuxt/src/core/runtime/nitro/error.ts#L18-L21) which we need for our logging platform.
We have defined a custom nitro error handler:
which works great for getting the original error object — however, we’d like to the invoke the default Nuxt error handling. in a perfect world our handler would just be a higher order function:
GitHub
nuxt/packages/nuxt/src/core/runtime/nitro/error.ts at 2466af53b0331...
The Intuitive Vue Framework. Contribute to nuxt/nuxt development by creating an account on GitHub.
0 Replies