aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/utilities/wolfram.py
diff options
context:
space:
mode:
authorGravatar Karlis Suvi <[email protected]>2022-10-29 04:17:52 +0300
committerGravatar GitHub <[email protected]>2022-10-28 18:17:52 -0700
commit19384dca56863dcfedd413c8cec4c689a3145793 (patch)
tree65969c9abf8ad3ae0436a3c3c5b19a72ffbc0b2d /bot/exts/utilities/wolfram.py
parentBump flake8-bugbear from 22.10.25 to 22.10.27 (#1134) (diff)
Catch more status codes in Wolfram commands (#1136)
Diffstat (limited to 'bot/exts/utilities/wolfram.py')
-rw-r--r--bot/exts/utilities/wolfram.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bot/exts/utilities/wolfram.py b/bot/exts/utilities/wolfram.py
index 984431f0..a2f1228a 100644
--- a/bot/exts/utilities/wolfram.py
+++ b/bot/exts/utilities/wolfram.py
@@ -202,6 +202,13 @@ class Wolfram(Cog):
message = "Wolfram API key is invalid or missing."
footer = ""
color = Colours.soft_red
+ elif status != 200:
+ # Handle all other possible status codes here
+ message = f"Unexpected status code from Wolfram API: {status}"
+ footer = ""
+ color = Colours.soft_red
+
+ log.warning(f"Unexpected status code from Wolfram API: {status}\nInput: {query}")
else:
message = ""
footer = "View original for a bigger picture."
@@ -281,6 +288,12 @@ class Wolfram(Cog):
elif response_text == "Error 1: Invalid appid.":
message = "Wolfram API key is invalid or missing."
color = Colours.soft_red
+ elif status != 200:
+ # Handle all other possible status codes here
+ message = f"Unexpected status code from Wolfram API: {status}"
+ color = Colours.soft_red
+
+ log.warning(f"Unexpected status code from Wolfram API: {status}\nInput: {query}")
else:
message = response_text
color = Colours.soft_orange