Source code for ezcord.errors

from __future__ import annotations

from .internal.dc import DPY, discord

if DPY:
    _DC_ERROR_TYPE = discord.app_commands.AppCommandError
else:
    _DC_ERROR_TYPE = discord.DiscordException


[docs] class ErrorMessageSent(_DC_ERROR_TYPE): # type: ignore """Exception that can be raised to indicate that an error message has already been sent to the user. This could be useful if an error message has already been sent to the user within a check function. This prevents further messages to the user, as this error will be ignored by the default error handler. """
[docs] class EzcordException(Exception): """Base exception class for all Ezcord exceptions."""
[docs] class ConvertTimeError(EzcordException): """Raised when a time conversion fails."""
[docs] class DurationError(ConvertTimeError): """Raised when a given duration is too long."""
[docs] class Blacklisted(EzcordException): """Can be raised when a blacklisted user tries to use a command. This error can be caught in a command error handler to send a custom response. """
[docs] class InvalidFormat(EzcordException): """Raised when an invalid URL has been passed."""
[docs] class MessageNotFound(EzcordException): """Raised when a message is not found in a certain channel."""
[docs] class ChannelNotFound(EzcordException): """Raised when a channel is not found."""
[docs] class GuildMismatch(MessageNotFound): """Raised when a message does not belong to the specified guild."""
[docs] class MissingPermission(EzcordException): """Raised when the bot does not have permission to access a certain object."""