diff --git a/cogs/refractor.py b/cogs/refractor.py index a1f2f63..00ac2b7 100644 --- a/cogs/refractor.py +++ b/cogs/refractor.py @@ -181,11 +181,24 @@ class Refractor(commands.Cog): data = await db_get("refractor/cards", params=params) if not data: + logger.error( + "Refractor API returned empty response for team %s", team["id"] + ) await interaction.edit_original_response( content="No refractor data found for your team." ) return + # API error responses contain "detail" key + if isinstance(data, dict) and "detail" in data: + logger.error( + "Refractor API error for team %s: %s", team["id"], data["detail"] + ) + await interaction.edit_original_response( + content="Something went wrong fetching refractor data. Please try again later." + ) + return + items = data if isinstance(data, list) else data.get("items", []) total_count = ( data.get("count", len(items)) if isinstance(data, dict) else len(items)