aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/exceptions.py
diff options
context:
space:
mode:
authorGravatar bradtimmis <[email protected]>2021-08-30 22:09:44 -0400
committerGravatar bradtimmis <[email protected]>2021-08-30 22:09:44 -0400
commit8bc54b2e2aeaeef30efd9f7f684cce48b7b64daf (patch)
tree91e844d1431a127815d33406139e5798341b533a /bot/utils/exceptions.py
parentNumerous syntax and bug fixes (diff)
parentMerge pull request #831 from brad90four/patch-1 (diff)
Update branch with main
Diffstat (limited to 'bot/utils/exceptions.py')
-rw-r--r--bot/utils/exceptions.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py
index 2b1c1b31..bf0e5813 100644
--- a/bot/utils/exceptions.py
+++ b/bot/utils/exceptions.py
@@ -1,4 +1,17 @@
+from typing import Optional
+
+
class UserNotPlayingError(Exception):
- """Will raised when user try to use game commands when not playing."""
+ """Raised when users try to use game commands when they are not playing."""
pass
+
+
+class APIError(Exception):
+ """Raised when an external API (eg. Wikipedia) returns an error response."""
+
+ def __init__(self, api: str, status_code: int, error_msg: Optional[str] = None):
+ super().__init__()
+ self.api = api
+ self.status_code = status_code
+ self.error_msg = error_msg