onCommandError property
A stream of CommandsException
s that occur during a command's execution.
Any error that occurs during the execution of a command will be added here, allowing you to respond to errors you might encounter during a command's execution. Notably, CheckFailedExceptions are added to this stream, so you can respond to a failed check here.
CommandsErrors that occur during the registration of a command will not be added to this stream, now will any object thrown that is not an Exception.
Exceptions thrown from within a command will be wrapped in an UncaughtException, allowing you to access the context in which a command was thrown.
By default, nyxx_commands logs all exceptions added to this stream. This behavior can be changed in options.
You might also be interested in:
CommandsException
, the class all exceptions in nyxx_commands subclass;- CallHooked.onPostCall, a stream that emits CommandContexts once a command completes successfully.
Implementation
late final Stream<CommandsException> onCommandError = _onCommandErrorController.stream;