Skip to content

Commit c4be2c6

Browse files
committed
fix: better logging of unhandled promises / warnings
1 parent 47ac8e1 commit c4be2c6

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

shared/packages/api/src/logger.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,10 @@ export function setupLogging(config: { process: ProcessConfig }): LoggerInstance
9999

100100
// Because the default NodeJS-handler sucks and wont display error properly
101101
process.on('unhandledRejection', (reason: any, p: any) => {
102-
logger.error('Unhandled Promise rejection, see below')
103-
logger.error('reason:', reason)
104-
logger.error('promise:', p)
105-
// logger.error('c:', c)
102+
logger.error(`Unhandled Promise rejection, reason: ${reason}, promise: ${p}`)
106103
})
107104
process.on('warning', (e: any) => {
108-
logger.warn('Unhandled warning, see below')
109-
logger.error('error', e)
110-
logger.error('error.reason', e.reason || e.message)
111-
logger.error('error.stack', e.stack)
105+
logger.error(`Unhandled warning: ${stringifyError(e)}`)
112106
})
113107
return logger
114108
}

0 commit comments

Comments
 (0)