From 308c0f2cda1a768b44a4a63c7de08e16a858366f Mon Sep 17 00:00:00 2001 From: Furkan Date: Thu, 14 Nov 2024 01:54:31 +0300 Subject: [PATCH] feat: raise if Slack API fails in DAQJobAlertSlack --- src/daq/alert/alert_slack.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/daq/alert/alert_slack.py b/src/daq/alert/alert_slack.py index e19ede4..c81be5a 100644 --- a/src/daq/alert/alert_slack.py +++ b/src/daq/alert/alert_slack.py @@ -35,7 +35,7 @@ def send_webhook(self, alert: DAQJobMessageAlert): f"Sending alert to Slack: [{alert.alert_info.severity}] {alert.alert_info.message}" ) assert alert.daq_job_info is not None - self._slack.post( + res = self._slack.post( attachments=[ { "fallback": alert.alert_info.message, @@ -62,3 +62,5 @@ def send_webhook(self, alert: DAQJobMessageAlert): } ] ) + if res != "ok": + raise Exception("Slack webhook returned error!")