Skip to content

Commit

Permalink
ELE-2444 - add logs for Slack alerts sending errors
Browse files Browse the repository at this point in the history
  • Loading branch information
IDoneShaveIt committed Feb 5, 2024
1 parent 0e5bec1 commit 5a6d46a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
from elementary.utils.json_utils import (
list_of_lists_of_strings_to_comma_delimited_unique_strings,
)
from elementary.utils.log import get_logger

logger = get_logger(__name__)


TABLE_FIELD = "table"
COLUMN_FIELD = "column"
Expand Down Expand Up @@ -954,7 +958,10 @@ def send_alert(
sent_successfully = self.client.send_message(
channel_name=channel_name, message=template
)
except Exception:
except Exception as err:
logger.error(
f"Unable to send alert via Slack: {err}\nSending fallback template."
)
sent_successfully = False

if not sent_successfully:
Expand All @@ -963,7 +970,8 @@ def send_alert(
fallback_sent_successfully = self.client.send_message(
channel_name=channel_name, message=fallback_template
)
except Exception:
except Exception as err:
logger.error(f"Unable to send alert fallback via Slack: {err}")
fallback_sent_successfully = False
self.message_builder.reset_slack_message()
return fallback_sent_successfully
Expand Down

0 comments on commit 5a6d46a

Please sign in to comment.