From 1ee64fd82497cf8cebb22b14bb05a8a5577ec27d Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Thu, 12 Sep 2024 00:34:56 +0300 Subject: [PATCH] add error catch --- logs_parser.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/logs_parser.py b/logs_parser.py index 49250c3..5185497 100644 --- a/logs_parser.py +++ b/logs_parser.py @@ -44,9 +44,12 @@ def parse_logs(timeout): unsuccessful_attempts += 1 retry_info = data["message"].split("Retry ")[1].strip("()") current_retry, max_retry = map(int, retry_info.split("/")) - #if current_retry == max_retry: - # print(f"Max Retry Reached: {data}", flush=True) - # return False, "Max Retry Reached" + if current_retry == max_retry: + print(f"Max Retry Reached: {data}", flush=True) + return False, "Max Retry Reached" + elif data.get("message") == "Error getting latest open worker nonce on topic": + print(f"Error: {data}", flush=True) + return False, "Error getting latest open worker nonce on topic" except Exception as e: print(f"Exception occurred: {e}", flush=True)