From bf5b7f6c35fb2508fecdfa15c7d8dbec4b771017 Mon Sep 17 00:00:00 2001 From: Freeman <46896789+soranoo@users.noreply.github.com> Date: Wed, 25 Dec 2024 11:33:08 +0000 Subject: [PATCH] fix: remove redundant error handling --- src/handlers/email_signal_extraction.py | 10 ++++------ src/handlers/ngrok_signal_redirect.py | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/handlers/email_signal_extraction.py b/src/handlers/email_signal_extraction.py index e67f073..0168736 100644 --- a/src/handlers/email_signal_extraction.py +++ b/src/handlers/email_signal_extraction.py @@ -89,12 +89,10 @@ def on_email_received(self, el, msgs): email_content = json.loads(email_content) email_content = json.dumps(email_content) log.info(f"Sending webhook alert<{email_subject}>, content: {email_content}") - try: - broadcast(email_content) - log.info(f"The whole process taken {round((datetime.now(timezone.utc) - email_date).total_seconds(), 3)}s.") - self.add_email_to_history(email_uid) - except Exception as err: - log.error(f"Sent webhook failed, reason: {err}") + + broadcast(email_content) + log.info(f"The whole process taken {round((datetime.now(timezone.utc) - email_date).total_seconds(), 3)}s.") + self.add_email_to_history(email_uid) def start(self): if self.imap_auto_reconnect_wait <= 0: diff --git a/src/handlers/ngrok_signal_redirect.py b/src/handlers/ngrok_signal_redirect.py index b0b8879..4cd1171 100644 --- a/src/handlers/ngrok_signal_redirect.py +++ b/src/handlers/ngrok_signal_redirect.py @@ -38,11 +38,8 @@ def on_data_received(self, data: dict): return log.info(f"Sending webhook alert<{email_subject}>, content: {email_content}") - try: - broadcast(email_content) - log.info(f"The whole process taken {self.calculate_seconds_to_now(receive_datetime)}s.") - except Exception as err: - log.error(f"Sent webhook failed, reason: {err}") + broadcast(email_content) + log.info(f"The whole process taken {self.calculate_seconds_to_now(receive_datetime)}s.") def setup_ngrok(self, port: int): try_import("pyngrok")