From 31128bb18aebfe9ae83d3bfe41fac7d39c6e5f39 Mon Sep 17 00:00:00 2001 From: lukasthaler Date: Fri, 1 Mar 2024 08:55:39 +0100 Subject: [PATCH] fix: catch&raise stray response HTTP status codes --- coc/http.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coc/http.py b/coc/http.py index 4cfc4b44..3bc06e8f 100644 --- a/coc/http.py +++ b/coc/http.py @@ -353,6 +353,9 @@ async def request(self, route, **kwargs): await asyncio.sleep(tries * 2 + 1) continue + # catch any stray status codes + raise HTTPException(response, data) + except asyncio.TimeoutError: # api timed out, retry again if tries > 3: @@ -360,7 +363,6 @@ async def request(self, route, **kwargs): await asyncio.sleep(tries * 2 + 1) continue - raise else: if response.status in (500, 502, 504):