mirror of
https://github.com/pockethost/pockethost.git
synced 2026-02-27 05:23:18 +00:00
chore: improve process exit cleanup
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { PUBLIC_DEBUG } from '$constants'
|
||||
import { LoggerService } from '@pockethost/common'
|
||||
import { gracefulExit } from 'exit-hook'
|
||||
;['unhandledRejection', 'uncaughtException'].forEach((type) => {
|
||||
process.on(type, (e) => {
|
||||
const { error } = LoggerService().create(type)
|
||||
@@ -7,7 +8,8 @@ import { LoggerService } from '@pockethost/common'
|
||||
error(`${e}`)
|
||||
|
||||
if (PUBLIC_DEBUG) {
|
||||
throw e
|
||||
console.error(e.stack)
|
||||
gracefulExit()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user