diff --git a/bible/bible.py b/bible/bible.py index d518292..a53bc23 100644 --- a/bible/bible.py +++ b/bible/bible.py @@ -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"] diff --git a/bible/errors.py b/bible/errors.py index 0bbb571..ac9d9f0 100644 --- a/bible/errors.py +++ b/bible/errors.py @@ -4,3 +4,7 @@ class BibleAccessError(Exception): class Unauthorized(Exception): pass + + +class NotFound(Exception): + pass