From cec804951b97bcab81551bb8c7a1a1e1c473aaa7 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Wed, 7 Oct 2020 13:03:27 +0800 Subject: [Update] --- ATRI/modules/error/__init__.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 ATRI/modules/error/__init__.py (limited to 'ATRI/modules/error') diff --git a/ATRI/modules/error/__init__.py b/ATRI/modules/error/__init__.py deleted file mode 100644 index 0f69608..0000000 --- a/ATRI/modules/error/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ -import json -import string -from pathlib import Path -from random import sample -from traceback import format_exc -from datetime import datetime -from typing import Optional - - -def errorBack(Lmsg: Optional[str] = None): - try: - with open(Path('.') / 'ATRI' / 'data' / 'errorData' / 'errorData.json', 'r') as f: - data = json.load(f) - except: - data = {} - - ran_str = ''.join(sample(string.ascii_letters + string.digits, 8)) - msg0 = f"{datetime.now()}\n" - msg0 += f"{format_exc()}" - data[f"{ran_str}"] = f"{msg0}" - - with open(Path('.') / 'ATRI' / 'data' / 'errorData' / 'errorData.json', 'w') as f: - f.write(json.dumps(data)) - f.close() - - if Lmsg: - pass - else: - Lmsg = 'unknown' - - msg0 = f'ERROR! Reason: [{Lmsg}]\n' - msg0 += f'trackID: {ran_str}\n' - msg0 += "请使用[来杯红茶]功能以联系维护者\n" - msg0 += "并附上 trackID" - - return msg0 \ No newline at end of file -- cgit v1.2.3