From d17e8f9b54bb6922b731bf8e0cabd6a761478782 Mon Sep 17 00:00:00 2001 From: KuetTai Date: Thu, 24 Oct 2024 16:02:23 +0800 Subject: [PATCH] Improve error message captured --- services/Evaluator.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/services/Evaluator.py b/services/Evaluator.py index 82fb18b..a4af512 100644 --- a/services/Evaluator.py +++ b/services/Evaluator.py @@ -29,13 +29,12 @@ def runSingleCheck(tmp_obj, method_name): code = e.response['Error']['Code'] msg = e.response['Error']['Message'] print(code, msg) - print(traceback.format_exc()) - traceback.format_exc() + emsg = traceback.format_exc() except Exception: - print(traceback.format_exc()) - traceback.format_exc() + emsg = traceback.format_exc() - return traceback.format_exc() + print(emsg) + return emsg class Evaluator(): def __init__(self): @@ -83,13 +82,11 @@ def run(self, serviceName): futures = [executor.submit(runSingleCheck, self, method) for method in filteredMethods] for future in cf.as_completed(futures): - for fr in future.result(): - if fr == 'OK': - continue - else: - emsg.append(fr) - ecnt += 1 - + if future.result() == 'OK': + continue + else: + emsg.append(future.result()) + ecnt += 1 else: for method in methods: if not rules or str.lower(method[6:]) in rules: