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:
hliu-roblox 2026-03-10 12:21:02 -07:00
parent ffc89e4ef6
commit 1e41d5b984

View file

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