diff --git a/matrix_alertbot/alert.py b/matrix_alertbot/alert.py index 6b3c1b5..dd07b44 100644 --- a/matrix_alertbot/alert.py +++ b/matrix_alertbot/alert.py @@ -37,7 +37,7 @@ class Alert: self.description = annotations["description"] if self.firing: - self.status = self.labels["severity"] + self.status = self.labels.get("severity", "unknown_alert") else: self.status = "resolved" @@ -55,11 +55,11 @@ class Alert: @property def emoji(self) -> str: - return self.EMOJIS[self.status] + return self.EMOJIS.get(self.status, "❓️") @property def color(self) -> str: - return self.COLORS[self.status] + return self.COLORS.get(self.status, "ffff0c") def match_label(self, label_name: str, pattern: re.Pattern[str]) -> bool: if label_name not in self.labels: