@cryptotaxi247 / CoPilot / commits / 20eee2cc

instead of raising error, return no results found (#160)

taylor_socfortress committed Feb 15, 2024 at 12:34 UTC 20eee2cc0bad165f6d243ff837f0b71ad318c886
1 file changed +5 -1
backend/app/integrations/monitoring_alert/routes/monitoring_alert.py
+5 -1
@@ -172,7 +172,11 @@ async def run_wazuh_analysis(
172 logger.info(f"Found {len(monitoring_alerts)} monitoring alerts")
173
174 if not monitoring_alerts:
175 - raise HTTPException(status_code=404, detail="No monitoring alerts found")
175 + logger.info(f"No monitoring alerts found for customer_code: {request.customer_code}")
176 + return AlertAnalysisResponse(
177 + success=True,
178 + message="No monitoring alerts found",
179 + )
180
181 # Call the analyze_wazuh_alerts function to analyze the alerts
182 await analyze_wazuh_alerts(monitoring_alerts, customer_meta, session)