Nuxt/test/fixtures/basic/server/plugins/headers.ts
2023-08-07 14:03:41 +01:00

13 lines
414 B
TypeScript

export default defineNitroPlugin((nitroApp) => {
if (!process.dev) { return }
const onError = nitroApp.h3App.options.onError!
nitroApp.h3App.options.onError = (error, event) => {
// TODO: somehow add error logging assertion to @nuxt/test-utils
if (error.message?.includes('Cannot set headers after they are sent to the client')) {
process.exit(1)
}
return onError(error, event)
}
})