Skip to content

Commit

Permalink
fix(node, preereender): add handler for unhandledRejection
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 7, 2022
1 parent 2dbc8b9 commit 3319912
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/entries/nitro-prerenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ import '#internal/nitro/virtual/polyfill'
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))
3 changes: 3 additions & 0 deletions src/runtime/entries/node-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ 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))

export default {}
3 changes: 3 additions & 0 deletions src/runtime/entries/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ import '#internal/nitro/virtual/polyfill'
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))

0 comments on commit 3319912

Please sign in to comment.