From cbd085125700c4ba3b83985c1fe505c48639d01f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 2 Mar 2024 15:56:42 -0800 Subject: [PATCH] fix(proxy_server.py): raise 422 error if no slack connection setup when calling `/health/services` --- litellm/proxy/proxy_server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 99bdb579c3c..ffae102a093 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -6514,6 +6514,11 @@ async def health_services_endpoint( if "slack" in general_settings.get("alerting", []): await proxy_logging_obj.alerting_handler(message="This is a test", level="Low") + else: + raise HTTPException( + status_code=422, + detail={"error": "No slack connection setup. Unable to test this."}, + ) @router.get("/health", tags=["health"], dependencies=[Depends(user_api_key_auth)])