Skip to content

Commit

Permalink
Merge pull request #7 from initialencounter/patch-1
Browse files Browse the repository at this point in the history
feat(onebot11):  Improve error handling in JSON parsing
  • Loading branch information
MliKiowa authored Apr 23, 2024
2 parents 1df3e9c + c40170d commit 56a1218
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 56a1218

Please sign in to comment.