aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils
diff options
context:
space:
mode:
authorGravatar D0rs4n <[email protected]>2021-08-02 21:58:21 +0200
committerGravatar D0rs4n <[email protected]>2021-08-02 21:58:21 +0200
commitf36cdb23cf9a8a5470180d85d336577658d849c3 (patch)
tree65f91b49a49eac8c48c9637a12c1dda2f0111915 /bot/utils
parentHandle Wikipedia API errors and warnings in the Wikipedia Cog (diff)
Refactor wiki_request, add External API related error,-handler
- Refactor wiki_request in the Wikipedia Cog, remove unnecessary else statements. - Add ExternalAPIError, and a handler for this Exception into error_handler
Diffstat (limited to 'bot/utils')
-rw-r--r--bot/utils/exceptions.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py
index 9e080759..5ccd6139 100644
--- a/bot/utils/exceptions.py
+++ b/bot/utils/exceptions.py
@@ -1,4 +1,14 @@
+
class UserNotPlayingError(Exception):
"""Raised when users try to use game commands when they are not playing."""
pass
+
+
+class ExternalAPIError(Exception):
+ """Raised when an external API(eg. Wikipedia) returns an error."""
+
+ def __init__(self, api: str):
+ super().__init__()
+ self.api = api
+ pass