Skip to content

Commit

Permalink
fix: remove redundant error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
soranoo committed Dec 25, 2024
1 parent 16df4d5 commit bf5b7f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/handlers/email_signal_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 2 additions & 5 deletions src/handlers/ngrok_signal_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bf5b7f6

Please sign in to comment.