diff --git a/src/runtime/entries/nitro-dev.ts b/src/runtime/entries/nitro-dev.ts index 602928b788..85817eb504 100644 --- a/src/runtime/entries/nitro-dev.ts +++ b/src/runtime/entries/nitro-dev.ts @@ -34,5 +34,10 @@ server.listen(listenAddress, () => { }) }) -process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) -process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +if (process.env.DEBUG) { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection]', err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException]', err)) +} else { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +} diff --git a/src/runtime/entries/nitro-prerenderer.ts b/src/runtime/entries/nitro-prerenderer.ts index 17a01f06f8..96620a20cb 100644 --- a/src/runtime/entries/nitro-prerenderer.ts +++ b/src/runtime/entries/nitro-prerenderer.ts @@ -3,5 +3,10 @@ import { nitroApp } from '../app' export const localFetch = nitroApp.localFetch -process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) -process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +if (process.env.DEBUG) { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection]', err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException]', err)) +} else { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +} diff --git a/src/runtime/entries/node-server.ts b/src/runtime/entries/node-server.ts index 845bf5be1f..ff94121ce2 100644 --- a/src/runtime/entries/node-server.ts +++ b/src/runtime/entries/node-server.ts @@ -23,7 +23,12 @@ server.listen(port, hostname, (err) => { console.log(`Listening on ${protocol}://${hostname}:${port}${useRuntimeConfig().app.baseURL}`) }) -process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) -process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +if (process.env.DEBUG) { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection]', err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException]', err)) +} else { + process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) + process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +} export default {} diff --git a/src/runtime/entries/node.ts b/src/runtime/entries/node.ts index 693ad05ad9..edba70e8da 100644 --- a/src/runtime/entries/node.ts +++ b/src/runtime/entries/node.ts @@ -3,5 +3,5 @@ import { nitroApp } from '../app' export const handler = nitroApp.h3App.nodeHandler -process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection] ' + err)) -process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException] ' + err)) +process.on('unhandledRejection', err => console.error('[nitro] [dev] [unhandledRejection]', err)) +process.on('uncaughtException', err => console.error('[nitro] [dev] [uncaughtException]', err))