diff options
| author | 2021-08-30 10:02:39 +0100 | |
|---|---|---|
| committer | 2021-08-30 10:02:39 +0100 | |
| commit | 7ae7117cd411d9d943b448076a38f6261fc2e286 (patch) | |
| tree | e7c4b9712899ef7a48a1fdf6207d7d9ab6323746 /bot/utils/exceptions.py | |
| parent | Make some return type annotations accurate (diff) | |
| parent | Merge pull request #816 from Objectivitix/patch-1 (diff) | |
Merge branch 'main' into duckduckduckgoose
Diffstat (limited to 'bot/utils/exceptions.py')
| -rw-r--r-- | bot/utils/exceptions.py | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py index 9e080759..bf0e5813 100644 --- a/bot/utils/exceptions.py +++ b/bot/utils/exceptions.py @@ -1,4 +1,17 @@ +from typing import Optional + +  class UserNotPlayingError(Exception):      """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 | 
