GlobalExceptionHandler

@InterfacedService(acceptMultiple = false)
interface GlobalExceptionHandler(source)

Interface with a method called everytime the framework catches an uncaught exception. This remplaces the standard implementation which logs the error and optionally sends it to the bot owners

Notes: You will need to handle things such as already acknowledged interactions (in the case of interaction events, where the exception happened after the interaction has been acknowledged), see isAcknowledged

Usage: Register your instance as a service with BService.

You are still free from extending GlobalExceptionHandlerAdapter.

See also

Inheritors

Functions

Link copied to clipboard
abstract fun onException(@Nullable event: @Nullable Event, @NotNull throwable: @NotNull Throwable)
Note: You are sent a generic Event, you will need to check it against SlashCommandInteractionEvent, GuildMessageReceivedEvent, etc...