mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat(onebot11): Improve error handling in JSON parsing
发生错误直接被 catch 掉了,没有提示,[使用docker启动后,请求被重置](https://github.com/NapNeko/NapCat-Docker/issues/8)
This commit is contained in:
parent
1df3e9c414
commit
c40170db5d
@ -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