✨ Added CommandExecutionException which wraps any exception thrown during the execution of command handlers. Should be handled using CommandManager#registerExceptionHandler, similar to NoSuchCommandException, ArgumentParseException, etc.
This commit is contained in:
parent
2f0ded5be6
commit
7df6917fe4
14 changed files with 240 additions and 32 deletions
|
|
@ -28,6 +28,7 @@ import cloud.commandframework.annotations.injection.ParameterInjectorRegistry;
|
|||
import cloud.commandframework.arguments.CommandArgument;
|
||||
import cloud.commandframework.arguments.flags.FlagContext;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.CommandExecutionException;
|
||||
import cloud.commandframework.execution.CommandExecutionHandler;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
|
|
@ -115,8 +116,10 @@ class MethodCommandExecutionHandler<C> implements CommandExecutionHandler<C> {
|
|||
/* Invoke the command method */
|
||||
try {
|
||||
this.methodHandle.invokeWithArguments(arguments);
|
||||
} catch (final Throwable e) {
|
||||
e.printStackTrace();
|
||||
} catch (final Error e) {
|
||||
throw e;
|
||||
} catch (final Throwable throwable) {
|
||||
throw new CommandExecutionException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue