From 484c97ca98d1895a2b38f3d5653b79834e603b8c Mon Sep 17 00:00:00 2001 From: Irmo van den Berge Date: Fri, 10 Dec 2021 16:47:49 +0100 Subject: [PATCH] Fix concurrent cause of execution exception not being wrapped right Signed-off-by: Irmo van den Berge --- .../execution/CommandExecutionCoordinator.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cloud-core/src/main/java/cloud/commandframework/execution/CommandExecutionCoordinator.java b/cloud-core/src/main/java/cloud/commandframework/execution/CommandExecutionCoordinator.java index c0387b3d..aa613e20 100644 --- a/cloud-core/src/main/java/cloud/commandframework/execution/CommandExecutionCoordinator.java +++ b/cloud-core/src/main/java/cloud/commandframework/execution/CommandExecutionCoordinator.java @@ -118,6 +118,13 @@ public abstract class CommandExecutionCoordinator { if (this.getCommandTree().getCommandManager().postprocessContext(commandContext, command) == State.ACCEPTED) { try { 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) { completableFuture.completeExceptionally(exception); } catch (final Exception exception) {