Skip to content

Commit

Permalink
feat(cli): handle unhandledRejection
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 12, 2020
1 parent 564b2cf commit 8f6d6fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/koishi-cli/src/worker.ts
Expand Up @@ -4,6 +4,7 @@ import { performance } from 'perf_hooks'
import { cyan } from 'kleur'
import { resolve } from 'path'
import { logger } from './utils'
import { format } from 'util'

const { version } = require('../package')

Expand Down Expand Up @@ -122,6 +123,10 @@ onStart(() => {
process.send({ type: 'start' })
})

process.on('unhandledRejection', (error) => {
logger.warn(format(error), baseLogLevel)
})

appList.forEach((app) => {
const { logLevel = 0, logFilter = {} } = app.options as AppConfig

Expand Down

0 comments on commit 8f6d6fa

Please sign in to comment.