handle silence not found exception
This commit is contained in:
parent
baf73ea5a2
commit
6618f7352c
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue