From 3494649b2f60be8b4512ee66d6004508a0ca0d42 Mon Sep 17 00:00:00 2001 From: hliu-roblox <87345548+hliu-roblox@users.noreply.github.com> Date: Tue, 10 Mar 2026 15:16:05 -0700 Subject: [PATCH] fix: use dynamic exception name and add logging for PATCH/DELETE Address review feedback: - Use type(e).__name__ instead of hardcoded ConnectError for accurate log labels when the exception is RemoteProtocolError - Add warning logs to patch() and delete() catch blocks for consistency with apost() and put() --- litellm/llms/custom_httpx/http_handler.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/litellm/llms/custom_httpx/http_handler.py b/litellm/llms/custom_httpx/http_handler.py index 859ea6d2b4d..ff0f25b9e1b 100644 --- a/litellm/llms/custom_httpx/http_handler.py +++ b/litellm/llms/custom_httpx/http_handler.py @@ -467,7 +467,7 @@ class AsyncHTTPHandler: response.raise_for_status() return response except (httpx.RemoteProtocolError, httpx.ConnectError) as e: - verbose_logger.warning(f"ConnectError on POST {url}: {e}") + verbose_logger.warning(f"{type(e).__name__} on POST {url}: {e}") # Retry the request with a new session if there is a connection error new_client = self.create_client( timeout=timeout, event_hooks=self.event_hooks @@ -540,7 +540,7 @@ class AsyncHTTPHandler: response.raise_for_status() return response except (httpx.RemoteProtocolError, httpx.ConnectError) as e: - verbose_logger.warning(f"ConnectError on PUT {url}: {e}") + verbose_logger.warning(f"{type(e).__name__} on PUT {url}: {e}") # Retry the request with a new session if there is a connection error new_client = self.create_client( timeout=timeout, event_hooks=self.event_hooks @@ -606,7 +606,8 @@ class AsyncHTTPHandler: response = await self.client.send(req) response.raise_for_status() return response - except (httpx.RemoteProtocolError, httpx.ConnectError): + except (httpx.RemoteProtocolError, httpx.ConnectError) as e: + verbose_logger.warning(f"{type(e).__name__} on PATCH {url}: {e}") # Retry the request with a new session if there is a connection error new_client = self.create_client( timeout=timeout, event_hooks=self.event_hooks @@ -672,7 +673,8 @@ class AsyncHTTPHandler: response = await self.client.send(req, stream=stream) response.raise_for_status() return response - except (httpx.RemoteProtocolError, httpx.ConnectError): + except (httpx.RemoteProtocolError, httpx.ConnectError) as e: + verbose_logger.warning(f"{type(e).__name__} on DELETE {url}: {e}") # Retry the request with a new session if there is a connection error new_client = self.create_client( timeout=timeout, event_hooks=self.event_hooks