mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 增加错误处理和日志记录功能
在 switchers.js 中,为 setOversea 和 setLagrange 方法添加了 try-catch 错误处理结构,并在捕获到错误时向用户发送错误消息。同时,对 autoclearTrash 函数进行了重构,使其成为异步函数,并添加了错误日志记录。 此外,对 file.js 中的日志记录语句进行了格式调整,以提高代码的可读性和一致性。 ```
This commit is contained in:
parent
5fcdc95b1a
commit
747e22453f
@ -242,11 +242,11 @@ function autoclear(time) {
|
|||||||
schedule.scheduleJob(time, async function () {
|
schedule.scheduleJob(time, async function () {
|
||||||
try {
|
try {
|
||||||
const { dataClearFileLen, rTempFileLen } = await autoclearTrash();
|
const { dataClearFileLen, rTempFileLen } = await autoclearTrash();
|
||||||
console.log(`自动清理垃圾完成:\n` +
|
logger.info(`自动清理垃圾完成:\n` +
|
||||||
`- 清理了${ dataClearFileLen }个垃圾文件\n` +
|
`- 清理了${ dataClearFileLen }个垃圾文件\n` +
|
||||||
`- 清理了${ rTempFileLen }个群临时文件`);
|
`- 清理了${ rTempFileLen }个群临时文件`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`自动清理垃圾时发生错误: ${ err.message }`);
|
logger.error(`自动清理垃圾时发生错误: ${ err.message }`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user