From c355583f59e78696df5ace4b0717f3fc4a247826 Mon Sep 17 00:00:00 2001 From: Alex Tau Date: Sat, 16 Aug 2025 13:24:47 +0300 Subject: [PATCH] meaningful exception handling for vulnix --- src/lego_monitoring/checks/vulnix/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lego_monitoring/checks/vulnix/__init__.py b/src/lego_monitoring/checks/vulnix/__init__.py index 2e866e6..c25bfd6 100644 --- a/src/lego_monitoring/checks/vulnix/__init__.py +++ b/src/lego_monitoring/checks/vulnix/__init__.py @@ -2,7 +2,6 @@ from socket import gethostname from lego_monitoring.alerting.alert import Alert from lego_monitoring.alerting.enum import AlertType, Severity -from lego_monitoring.alerting.sender import send_alert from ..utils import format_for_healthchecks_slug from .vulnix import get_vulnix_output @@ -16,15 +15,14 @@ async def vulnix_check() -> list[Alert]: try: vulnix_output = get_vulnix_output(IS_TESTING) except Exception as e: - await send_alert( + return [ Alert( - alert_type=AlertType.ERROR, + AlertType.VULN, message=f"Exception {type(e).__name__} while calling vulnix: {e}", severity=Severity.CRITICAL, healthchecks_slug=slug, ) - ) - return [] + ] for finding in vulnix_output: if not IS_TESTING: non_whitelisted_cves = [k for k in finding.description if k not in finding.whitelisted]