mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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()
This commit is contained in:
parent
1e41d5b984
commit
3494649b2f
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue