error ¶
Error handling system for Tux Discord bot.
Modules:
-
cog–Comprehensive error handler for Discord commands.
-
config–Error handler configuration.
-
extractors–Error detail extraction utilities.
-
formatter–Error message formatting utilities.
-
suggestions–Command suggestion utilities.
Classes:
-
ErrorHandler–Centralized error handling for both prefix and slash commands.
Classes¶
ErrorHandler ¶
ErrorHandler(bot: Tux)
Bases: Cog
Centralized error handling for both prefix and slash commands.
Initialize the error handler cog.
Parameters:
-
bot(Tux) –The bot instance to attach this cog to.
Methods:
-
cog_load–Override app command error handler.
-
cog_unload–Restore original app command error handler.
-
cog_reload–Handle cog reload - force reload imported modules.
-
on_command_error–Handle prefix command errors.
-
on_app_command_error–Handle app command errors.
Functions¶
_handle_error async ¶
_handle_error(source: Context[Tux] | Interaction, error: Exception) -> None
Handle errors for commands and interactions.
_set_sentry_context ¶
_set_sentry_context(source: Context[Tux] | Interaction, error: Exception) -> None
Set enhanced Sentry context for error reporting.
_get_error_config ¶
_get_error_config(error: Exception) -> ErrorHandlerConfig
_log_error ¶
_log_error(error: Exception, config: ErrorHandlerConfig) -> None
Log error with appropriate level.
_send_error_response async ¶
_send_error_response(
source: Context[Tux] | Interaction, embed: Embed, config: ErrorHandlerConfig
) -> None
Send error response to user.
on_command_error async ¶
on_command_error(ctx: Context[Tux], error: CommandError) -> None
Handle prefix command errors.
on_app_command_error async ¶
on_app_command_error(interaction: Interaction[Tux], error: AppCommandError) -> None
Handle app command errors.