perf: 添加JSON配置文件语法检查 (#796)

This commit is contained in:
RockChinQ
2024-05-29 21:11:21 +08:00
parent 96832b6f7d
commit f81808d239
3 changed files with 10 additions and 16 deletions
+4 -1
View File
@@ -37,7 +37,10 @@ class JSONConfigFile(file_model.ConfigFile):
self.template_data = json.load(f)
with open(self.config_file_name, "r", encoding="utf-8") as f:
cfg = json.load(f)
try:
cfg = json.load(f)
except json.JSONDecodeError as e:
raise Exception(f"配置文件 {self.config_file_name} 语法错误: {e}")
if completion: