From 5c911c71a18e325863b0ef7af78ba04cab78ade2 Mon Sep 17 00:00:00 2001 From: Kyomotoi Date: Sat, 14 May 2022 00:00:26 +0800 Subject: =?UTF-8?q?=E2=99=BF=EF=B8=8F=20=E4=BC=98=E5=8C=96=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/service.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'ATRI/service.py') diff --git a/ATRI/service.py b/ATRI/service.py index c9509df..c52f5ca 100644 --- a/ATRI/service.py +++ b/ATRI/service.py @@ -17,7 +17,7 @@ from nonebot.typing import ( ) from nonebot.rule import Rule, command, keyword, regex -from ATRI.exceptions import ReadFileError, WriteError +from ATRI.exceptions import ReadFileError, WriteFileError SERVICE_DIR = Path(".") / "data" / "service" @@ -101,8 +101,8 @@ class Service: try: with open(path, "w", encoding="utf-8") as w: w.write(json.dumps(data.dict(), indent=4)) - except WriteError: - raise WriteError("Write service info failed!") + except WriteFileError: + raise WriteFileError("Write service info failed!") def save_service(self, service_data: dict, service: str) -> None: if not service: @@ -304,9 +304,9 @@ class ServiceTools(object): path = SERVICES_DIR / f"{service}.json" if not path.is_file(): raise ReadFileError( - f"Can't find service: ({service}) file.\n" - "Please delete all file in data/service/services.\n" - "Next reboot bot." + f"Can't find service file: {service}\n" + "Please delete all file in data/service/services\n" + "And reboot bot." ) with open(path, "w", encoding="utf-8") as w: @@ -317,9 +317,9 @@ class ServiceTools(object): path = SERVICES_DIR / f"{service}.json" if not path.is_file(): raise ReadFileError( - f"Can't find service: ({service}) file.\n" - "Please delete all file in data/service/services.\n" - "Next reboot bot." + f"Can't find service file: {service}\n" + "Please delete all file in data/service/services\n" + "And reboot bot." ) with open(path, "r", encoding="utf-8") as r: -- cgit v1.2.3