aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-05-22 22:26:57 +0100
committerGravatar Chris Lovering <[email protected]>2022-05-22 22:26:57 +0100
commit67f88c7a76d732e5e6d283eb1a24fbf12b766148 (patch)
treeac427d99b714b9d5f5ed80d670857e17941d402e
parentMerge pull request #2177 from python-discord/fix-tag-stats (diff)
Use existing ResponseCodeError attrs rather than fetch again
This also updates the log string to use % based format strings, rather than a mix of f-string and % string which caused the %r to not work.
-rw-r--r--bot/exts/backend/error_handler.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index 35dddd8dc..194a4889d 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -284,8 +284,11 @@ class ErrorHandler(Cog):
await ctx.send("There does not seem to be anything matching your query.")
ctx.bot.stats.incr("errors.api_error_404")
elif e.status == 400:
- content = await e.response.json()
- log.error(f"API responded with 400 for command {ctx.command}: %r.", content)
+ log.error(
+ "API responded with 400 for command %s: %r.",
+ ctx.command,
+ e.response_json or e.response_text,
+ )
await ctx.send("According to the API, your request is malformed.")
ctx.bot.stats.incr("errors.api_error_400")
elif 500 <= e.status < 600: