SeaCogs/bible/errors.py
SeaswimmerTheFsh 220e8da790
All checks were successful
Actions / Lint Code (Pylint) (push) Successful in 17s
Actions / Build Documentation (MkDocs) (push) Successful in 12s
fix(bible): added error handling for if API.Bible is down
2024-02-02 00:05:36 -05:00

41 lines
1.2 KiB
Python

from redbot.core.utils.chat_formatting import error
class BibleAccessError(Exception):
def __init__(
self,
message: str = error(
"The provided API key cannot retrieve sections from the configured Bible. Please report this to the bot owner."
),
):
super().__init__(message)
self.message = message
class Unauthorized(Exception):
def __init__(
self,
message: str = error(
"The API key for API.Bible is missing or invalid. Please report this to the bot owner.\nIf you are the bot owner, please check the documentation [here](<https://seacogs.coastalcommits.com/bible/#setup>)."
),
):
super().__init__(message)
self.message = message
class NotFound(Exception):
def __init__(
self,
message: str = error("The requested passage was not found."),
):
super().__init__(message)
self.message = message
class ServiceUnavailable(Exception):
def __init__(
self,
message: str = error("The API.Bible service is currently unavailable."),
):
super().__init__(message)
self.message = message