fix: add error logging and user-facing message for API failures
All checks were successful
Ruff Lint / lint (pull_request) Successful in 20s
All checks were successful
Ruff Lint / lint (pull_request) Successful in 20s
- Log API error detail when refractor endpoint returns an error - Show "Something went wrong" instead of misleading "No refractor data" - Log empty response case for debugging Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a9ef04d102
commit
1c21f674c2
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user