Fix concurrent cause of execution exception not being wrapped right

Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
This commit is contained in:
Irmo van den Berge 2021-12-10 16:47:49 +01:00 committed by Jason
parent 351951c196
commit 484c97ca98

View file

@ -118,6 +118,13 @@ public abstract class CommandExecutionCoordinator<C> {
if (this.getCommandTree().getCommandManager().postprocessContext(commandContext, command) == State.ACCEPTED) { if (this.getCommandTree().getCommandManager().postprocessContext(commandContext, command) == State.ACCEPTED) {
try { try {
command.getCommandExecutionHandler().executeFuture(commandContext).get(); command.getCommandExecutionHandler().executeFuture(commandContext).get();
} catch (final java.util.concurrent.ExecutionException exception) {
Throwable cause = exception.getCause();
if (cause instanceof CommandExecutionException) {
completableFuture.completeExceptionally(cause);
} else {
completableFuture.completeExceptionally(new CommandExecutionException(cause, commandContext));
}
} catch (final CommandExecutionException exception) { } catch (final CommandExecutionException exception) {
completableFuture.completeExceptionally(exception); completableFuture.completeExceptionally(exception);
} catch (final Exception exception) { } catch (final Exception exception) {