From 6618f7352c548d256d80f81e8f3300a284b7d694 Mon Sep 17 00:00:00 2001
From: HgO <hgo@batato.be>
Date: Wed, 6 Jul 2022 01:21:06 +0200
Subject: [PATCH] handle silence not found exception

---
 matrix_alertbot/bot_commands.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/matrix_alertbot/bot_commands.py b/matrix_alertbot/bot_commands.py
index 84dd953..d0abbbc 100644
--- a/matrix_alertbot/bot_commands.py
+++ b/matrix_alertbot/bot_commands.py
@@ -6,7 +6,11 @@ from nio import AsyncClient, MatrixRoom, RoomMessageText
 from matrix_alertbot.alertmanager import AlertmanagerClient
 from matrix_alertbot.chat_functions import react_to_event, send_text_to_room
 from matrix_alertbot.config import Config
-from matrix_alertbot.errors import AlertmanagerError, AlertNotFoundError
+from matrix_alertbot.errors import (
+    AlertmanagerError,
+    AlertNotFoundError,
+    SilenceNotFoundError,
+)
 
 logger = logging.getLogger(__name__)
 
@@ -122,7 +126,7 @@ class Command:
             )
             try:
                 self.alertmanager.delete_silence(alert_fingerprint)
-            except (AlertNotFoundError, AlertmanagerError) as e:
+            except (AlertNotFoundError, SilenceNotFoundError, AlertmanagerError) as e:
                 logger.error(f"Unable to delete silence: {e}")
                 continue
             count_removed_silences += 1