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:
hliu-roblox 2026-03-10 15:16:05 -07:00
parent 1e41d5b984
commit 3494649b2f

View file

@ -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