fix(bible): added error message for if a passage cannot be found

This commit is contained in:
Seaswimmer 2024-02-01 19:25:02 -05:00
parent 4a4ffcd1ee
commit 8da6f0d8de
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063
2 changed files with 7 additions and 1 deletions

View file

@ -13,7 +13,7 @@ from discord import Embed
from redbot.core import Config, commands from redbot.core import Config, commands
from redbot.core.bot import Red from redbot.core.bot import Red
from bible.errors import BibleAccessError, Unauthorized from bible.errors import BibleAccessError, NotFound, Unauthorized
class Bible(commands.Cog): class Bible(commands.Cog):
@ -73,6 +73,8 @@ class Bible(commands.Cog):
raise BibleAccessError( raise BibleAccessError(
"The provided API key cannot retrieve sections from the configured Bible." "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() data = await response.json()
return data["data"] return data["data"]

View file

@ -4,3 +4,7 @@ class BibleAccessError(Exception):
class Unauthorized(Exception): class Unauthorized(Exception):
pass pass
class NotFound(Exception):
pass