Skip to content

Commit

Permalink
Made error message loggin for the teams client a bit more verbose to …
Browse files Browse the repository at this point in the history
…facilitate users and support
  • Loading branch information
Frank Tubbing committed Feb 8, 2024
1 parent 28a6ec9 commit a422031
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def _get_dbt_test_template(self, alert: TestAlertModel, *args, **kwargs):
self._add_report_link_if_applicable(alert)

self.client.title(title)
self.client.text(subtitle)
self.client.summary(subtitle)

self._add_table_field_section_if_applicable(alert)
self._add_column_field_section_if_applicable(alert)
Expand Down Expand Up @@ -562,14 +562,17 @@ def send_alert(
self._get_alert_template(alert)
sent_successfully = self.client.send_message()
except Exception as e:
logger.error(e)
logger.error(
f"Unable to send alert via Teams: {e}\nSending fallback template."
)
sent_successfully = False

if not sent_successfully:
try:
self._get_fallback_template(alert)
fallback_sent_successfully = self.client.send_message()
except Exception:
logger.error(f"Unable to send alert fallback via Teams: {e}")
fallback_sent_successfully = False
sent_successfully = fallback_sent_successfully
# Resetting the client so that it does not cache the message of other alerts
Expand Down

0 comments on commit a422031

Please sign in to comment.