Merge pull request #7 from initialencounter/patch-1

feat(onebot11):  Improve error handling in JSON parsing
This commit is contained in:
手瓜一十雪 2024-04-24 00:07:55 +08:00 committed by GitHub
commit 56a12185d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,6 +67,11 @@ class Config implements OB11Config {
Object.assign(this, jsonData);
// eslint-disable-next-line
} catch (e) {
if (e instanceof SyntaxError) {
console.error(`配置文件 ${ob11ConfigPath} 格式错误,请检查配置文件:`, e.message);
}else{
console.error(`读取配置文件 ${ob11ConfigPath} 时发生错误:`, e.message);
}
}
return this;
}