From f36cdb23cf9a8a5470180d85d336577658d849c3 Mon Sep 17 00:00:00 2001 From: D0rs4n <41237606+D0rs4n@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:58:21 +0200 Subject: 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 --- bot/utils/exceptions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bot/utils/exceptions.py') 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 -- cgit v1.2.3