feat: 异常处理与log4js替换

This commit is contained in:
手瓜一十雪
2024-11-13 12:26:23 +08:00
parent bdaf1274b4
commit 78e4295ac5
4 changed files with 68 additions and 57 deletions

View File

@@ -36,7 +36,12 @@ const cmdOptions = program.opts();
// NapCat Shell App ES 入口文件
export async function NCoreInitShell() {
console.log('NapCat Shell App Loading...');
process.on('uncaughtException', (err) => {
console.log('[NapCat] [Error] Unhandled Exception:', err.message);
});
process.on('unhandledRejection', (reason, promise) => {
console.log('[NapCat] [Error] unhandledRejection:', reason);
});
const pathWrapper = new NapCatPathWrapper();
const logger = new LogWrapper(pathWrapper.logsPath);
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
@@ -227,7 +232,7 @@ export async function NCoreInitShell() {
logger.log(`可用于快速登录的 QQ\n${historyLoginList
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
.join('\n')
}`);
}`);
}
loginService.getQRCodePicture();
}