SeaCogs/bible/errors.py
cswimr 2859f93501
Some checks failed
Actions / Build Documentation (MkDocs) (push) Successful in 35s
Actions / Lint Code (Ruff & Pylint) (push) Failing after 40s
fix(bible): close asyncio session after unloading the cog
2025-01-26 00:39:09 +00:00

46 lines
1.5 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
class InexplicableError(Exception):
def __init__(
self,
message: str = error("An inexplicable 'Bad Request' error occurred. This error happens occasionally 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