From e1c2efc8c060fa96cff2f58b78c1bf123f3860fe Mon Sep 17 00:00:00 2001 From: KenanZhu <3471685733@qq.com> Date: Mon, 16 Feb 2026 13:01:34 +0800 Subject: [PATCH] =?UTF-8?q?chore(utils):=20=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=AF=BB=E5=86=99=E5=99=A8=E5=BC=82=E5=B8=B8=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/ConfigReader.py | 8 ++++---- src/utils/ConfigWriter.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/utils/ConfigReader.py b/src/utils/ConfigReader.py index e9c0805..99e5659 100644 --- a/src/utils/ConfigReader.py +++ b/src/utils/ConfigReader.py @@ -52,13 +52,13 @@ class ConfigReader: with open(self.__config_path, 'r', encoding='utf-8') as file: self.__config_data = json.load(file) except FileNotFoundError as e: - raise Exception(f"Config file not found: {self.__config_path}") from e + raise Exception(f"配置文件不存在: {self.__config_path}") from e except PermissionError as e: - raise Exception(f"Without enough permission to read config file: {self.__config_path}") from e + raise Exception(f"没有足够的权限读取配置文件: {self.__config_path}") from e except json.JSONDecodeError as e: - raise Exception(f"JSON decode error in config file: {self.__config_path}") from e + raise Exception(f"JSON 解析错误: {self.__config_path}") from e except Exception as e: - raise Exception(f"Unknown error occurred while reading config file: {e}") from e + raise Exception(f"读取配置文件时未知错误: {e}") from e def getConfigs( diff --git a/src/utils/ConfigWriter.py b/src/utils/ConfigWriter.py index 5373c56..a7092df 100644 --- a/src/utils/ConfigWriter.py +++ b/src/utils/ConfigWriter.py @@ -58,13 +58,13 @@ class ConfigWriter: with open(self.__config_path, "w", encoding="utf-8") as f: json.dump(self.__config_data, f, indent=4, sort_keys=False) except PermissionError as e: - raise Exception(f"Without enough permission to write config file: {self.__config_path}") from e + raise Exception(f"没有足够的权限写入配置文件: {self.__config_path}") from e except IOError as e: - raise Exception(f"IO error occurred while writing config file: {self.__config_path}") from e + raise Exception(f"写入配置文件时发生 IO 错误: {self.__config_path}") from e except TypeError as e: - raise Exception(f"Config data contains invalid type that can not be JSON serialized: {e}") from e + raise Exception(f"配置数据包含无法 JSON 序列化的类型: {e}") from e except Exception as e: - raise Exception(f"Unknown error occurred while writing config file: {e}") from e + raise Exception(f"写入配置文件时未知错误: {e}") from e def setConfigs(