diff --git a/packages/daemon/src/util/process.ts b/packages/daemon/src/util/process.ts index 530260ba..90ffb0e1 100644 --- a/packages/daemon/src/util/process.ts +++ b/packages/daemon/src/util/process.ts @@ -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() } }) })