handle silence not found exception

This commit is contained in:
HgO 2022-07-06 01:21:06 +02:00
parent baf73ea5a2
commit 6618f7352c

View file

@ -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