Skip to content

Commit 31128bb

Browse files
committed
fix: catch&raise stray response HTTP status codes
1 parent 8eb2142 commit 31128bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

coc/http.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,16 @@ async def request(self, route, **kwargs):
353353
await asyncio.sleep(tries * 2 + 1)
354354
continue
355355

356+
# catch any stray status codes
357+
raise HTTPException(response, data)
358+
356359
except asyncio.TimeoutError:
357360
# api timed out, retry again
358361
if tries > 3:
359362
raise GatewayError("The API timed out waiting for the request.")
360363

361364
await asyncio.sleep(tries * 2 + 1)
362365
continue
363-
raise
364366

365367
else:
366368
if response.status in (500, 502, 504):

0 commit comments

Comments
 (0)