diff --git a/bible/bible.py b/bible/bible.py index 1f03395..6b26d1f 100644 --- a/bible/bible.py +++ b/bible/bible.py @@ -74,6 +74,8 @@ class Bible(commands.Cog): "_get_passage executed with a response code of: %s", response.status, ) + if response.status == 400: + raise bible.errors.InexplicableError() if response.status == 401: raise bible.errors.Unauthorized() if response.status == 403: @@ -193,6 +195,7 @@ class Bible(commands.Cog): except ( bible.errors.BibleAccessError, bible.errors.NotFound, + bible.errors.InexplicableError, bible.errors.ServiceUnavailable, bible.errors.Unauthorized, ) as e: @@ -233,6 +236,7 @@ class Bible(commands.Cog): except ( bible.errors.BibleAccessError, bible.errors.NotFound, + bible.errors.InexplicableError, bible.errors.ServiceUnavailable, bible.errors.Unauthorized, ) as e: diff --git a/bible/errors.py b/bible/errors.py index c4c0592..04b5e06 100644 --- a/bible/errors.py +++ b/bible/errors.py @@ -39,3 +39,14 @@ class ServiceUnavailable(Exception): ): super().__init__(message) self.message = message + + +class InexplicableError(Exception): + def __init__( + self, + message: str = error( + "An explicable 'Bad Request' error occurred. This error happens occassionally with the API.Bible service. Please try again. If the error persists, please report this to the bot owner." + ), + ): + super().__init__(message) + self.message = message