mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
Merge pull request #7 from initialencounter/patch-1
feat(onebot11): Improve error handling in JSON parsing
This commit is contained in:
commit
56a12185d4
@ -67,6 +67,11 @@ class Config implements OB11Config {
|
|||||||
Object.assign(this, jsonData);
|
Object.assign(this, jsonData);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
console.error(`配置文件 ${ob11ConfigPath} 格式错误,请检查配置文件:`, e.message);
|
||||||
|
}else{
|
||||||
|
console.error(`读取配置文件 ${ob11ConfigPath} 时发生错误:`, e.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user