Skip to content

Commit

Permalink
feat(onebot11): Improve error handling in JSON parsing
Browse files Browse the repository at this point in the history
发生错误直接被 catch 掉了,没有提示,[使用docker启动后,请求被重置](NapNeko/NapCat-Docker#8)
  • Loading branch information
initialencounter authored Apr 23, 2024
1 parent 1df3e9c commit c40170d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/onebot11/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c40170d

Please sign in to comment.