mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
fix(logging): log ConnectError details before retry in http_handler
ConnectError and RemoteProtocolError exceptions are silently caught and retried without any logging, making it impossible to diagnose connection failures in production. Add verbose_logger.warning() to emit the target URL and error details before the retry attempt.
This commit is contained in:
parent
ffc89e4ef6
commit
1e41d5b984
1 changed files with 4 additions and 2 deletions
|
|
@ -466,7 +466,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"ConnectError 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
|
||||
|
|
@ -538,7 +539,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"ConnectError 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue