From ff0d3a833bbbe517f50124c5157223ff95876931 Mon Sep 17 00:00:00 2001 From: D0rs4n <41237606+D0rs4n@users.noreply.github.com> Date: Sun, 8 Aug 2021 15:51:44 +0200 Subject: Improve code consitency in Wikipedia Cog,Exceptions, and Error handler --- bot/utils/exceptions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bot/utils/exceptions.py') diff --git a/bot/utils/exceptions.py b/bot/utils/exceptions.py index 5ccd6139..73c8e3e1 100644 --- a/bot/utils/exceptions.py +++ b/bot/utils/exceptions.py @@ -1,3 +1,5 @@ +from typing import Optional + class UserNotPlayingError(Exception): """Raised when users try to use game commands when they are not playing.""" @@ -6,9 +8,10 @@ class UserNotPlayingError(Exception): class ExternalAPIError(Exception): - """Raised when an external API(eg. Wikipedia) returns an error.""" + """Raised when an external API(eg. Wikipedia) returns an error response.""" - def __init__(self, api: str): + def __init__(self, api: str, status_code: int, error_msg: Optional[str] = None): super().__init__() self.api = api - pass + self.status_code = status_code + self.error_msg = error_msg -- cgit v1.2.3