forked from cswimr/SeaCogs
fix(bible): added error message for if a passage cannot be found
This commit is contained in:
parent
4a4ffcd1ee
commit
8da6f0d8de
2 changed files with 7 additions and 1 deletions
|
@ -13,7 +13,7 @@ from discord import Embed
|
|||
from redbot.core import Config, commands
|
||||
from redbot.core.bot import Red
|
||||
|
||||
from bible.errors import BibleAccessError, Unauthorized
|
||||
from bible.errors import BibleAccessError, NotFound, Unauthorized
|
||||
|
||||
|
||||
class Bible(commands.Cog):
|
||||
|
@ -73,6 +73,8 @@ class Bible(commands.Cog):
|
|||
raise BibleAccessError(
|
||||
"The provided API key cannot retrieve sections from the configured Bible."
|
||||
)
|
||||
if response.status == 404:
|
||||
raise NotFound("The requested passage was not found.")
|
||||
data = await response.json()
|
||||
return data["data"]
|
||||
|
||||
|
|
|
@ -4,3 +4,7 @@ class BibleAccessError(Exception):
|
|||
|
||||
class Unauthorized(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NotFound(Exception):
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue