Skip to content

Commit

Permalink
fix: catch&raise stray response HTTP status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasthaler committed Mar 1, 2024
1 parent 8eb2142 commit 31128bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion coc/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,16 @@ 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:
raise GatewayError("The API timed out waiting for the request.")

await asyncio.sleep(tries * 2 + 1)
continue
raise

else:
if response.status in (500, 502, 504):
Expand Down

0 comments on commit 31128bb

Please sign in to comment.