From f510a709d17b887c62fbd7f85008d629feab0879 Mon Sep 17 00:00:00 2001 From: Paarth Shah Date: Wed, 11 Oct 2023 02:15:35 -0700 Subject: [PATCH] Broaden the error handling for httpx Exceptions (#17) --- netdata/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netdata/__init__.py b/netdata/__init__.py index a8c9072..7c196f6 100644 --- a/netdata/__init__.py +++ b/netdata/__init__.py @@ -44,7 +44,9 @@ async def get_data(self, url) -> Dict: try: async with httpx.AsyncClient() as client: response = await client.get(str(url), timeout = self.timeout) - except httpx.ConnectError: + except httpx.TimeoutException: + raise + except httpx.TransportError: raise exceptions.NetdataConnectionError( f"Connection to {self.scheme}://{self.host}:{self.port} failed" )