fix(bible): added inexplicableerror and handling for it
This commit is contained in:
parent
09302403b8
commit
fda80d4e41
2 changed files with 15 additions and 0 deletions
|
@ -74,6 +74,8 @@ class Bible(commands.Cog):
|
||||||
"_get_passage executed with a response code of: %s",
|
"_get_passage executed with a response code of: %s",
|
||||||
response.status,
|
response.status,
|
||||||
)
|
)
|
||||||
|
if response.status == 400:
|
||||||
|
raise bible.errors.InexplicableError()
|
||||||
if response.status == 401:
|
if response.status == 401:
|
||||||
raise bible.errors.Unauthorized()
|
raise bible.errors.Unauthorized()
|
||||||
if response.status == 403:
|
if response.status == 403:
|
||||||
|
@ -193,6 +195,7 @@ class Bible(commands.Cog):
|
||||||
except (
|
except (
|
||||||
bible.errors.BibleAccessError,
|
bible.errors.BibleAccessError,
|
||||||
bible.errors.NotFound,
|
bible.errors.NotFound,
|
||||||
|
bible.errors.InexplicableError,
|
||||||
bible.errors.ServiceUnavailable,
|
bible.errors.ServiceUnavailable,
|
||||||
bible.errors.Unauthorized,
|
bible.errors.Unauthorized,
|
||||||
) as e:
|
) as e:
|
||||||
|
@ -233,6 +236,7 @@ class Bible(commands.Cog):
|
||||||
except (
|
except (
|
||||||
bible.errors.BibleAccessError,
|
bible.errors.BibleAccessError,
|
||||||
bible.errors.NotFound,
|
bible.errors.NotFound,
|
||||||
|
bible.errors.InexplicableError,
|
||||||
bible.errors.ServiceUnavailable,
|
bible.errors.ServiceUnavailable,
|
||||||
bible.errors.Unauthorized,
|
bible.errors.Unauthorized,
|
||||||
) as e:
|
) as e:
|
||||||
|
|
|
@ -39,3 +39,14 @@ class ServiceUnavailable(Exception):
|
||||||
):
|
):
|
||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
self.message = 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
|
||||||
|
|
Loading…
Reference in a new issue