fix(config): 添加对 identity_detail 字段的非空校验
- 在配置文件加载过程中,增加了对 [identity] 部分的 identity_detail 字段的非空检查 - 如果 identity_detail 为空字符串,将抛出 ValueError 异常
This commit is contained in:
@@ -717,6 +717,10 @@ class BotConfig:
|
|||||||
logger.error(f"配置文件中缺少必需的字段: '{key}'")
|
logger.error(f"配置文件中缺少必需的字段: '{key}'")
|
||||||
raise KeyError(f"配置文件中缺少必需的字段: '{key}'")
|
raise KeyError(f"配置文件中缺少必需的字段: '{key}'")
|
||||||
|
|
||||||
|
# identity_detail字段非空检查
|
||||||
|
if not config.identity_detail:
|
||||||
|
raise ValueError("配置文件错误:[identity] 部分的 identity_detail 不能为空字符串")
|
||||||
|
|
||||||
logger.success(f"成功加载配置文件: {config_path}")
|
logger.success(f"成功加载配置文件: {config_path}")
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
Reference in New Issue
Block a user