!132 修复在不是Promise报错时自动结束进程

* 修复在不是Promise报错时自动结束进程
This commit is contained in:
小花花花儿 2023-12-11 19:14:36 +00:00 committed by Kokomi
parent c0470361b4
commit 06b5d3c154
1 changed files with 10 additions and 0 deletions

View File

@ -43,6 +43,16 @@ async function UpdateTitle() {
/** 设置时区 */
process.env.TZ = 'Asia/Shanghai'
/** 捕获未处理的错误 */
process.on('uncaughtException', (error) => {
let err = error
if (logger) {
logger.error(err)
} else {
console.log(err)
}
})
/** 捕获未处理的Promise错误 */
process.on('unhandledRejection', (error, promise) => {
let err = error