From 34897b956a3cabfd2401e9eb0dcfa3800385d9c8 Mon Sep 17 00:00:00 2001 From: plun1331 Date: Fri, 14 Aug 2026 00:07:41 -0700 Subject: [PATCH] Add error handling for Hypixel API responses Handle non-OK responses from Hypixel API with an error message. --- extensions/game_commands/game_commands.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/game_commands/game_commands.py b/extensions/game_commands/game_commands.py index f5cb6bf..78a7504 100644 --- a/extensions/game_commands/game_commands.py +++ b/extensions/game_commands/game_commands.py @@ -180,7 +180,10 @@ async def hypixel_request(self, *args, **kwargs): if self.session is None: self.session = aiohttp.ClientSession() async with self.session.get(*args, **kwargs) as resp: - return await resp.json() + data = await resp.json() + if resp.status not in (200, 404): + print(f"{Color.MAGENTA}Game Commands{Color.RESET} > {Color.RED}[ERROR]{Color.RESET} Non-OK response from Hypixel: {data}") + return async def cog_unload(self) -> None: if self.session is not None: