diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/Confirmation.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/Confirmation.java index dadbb1945..ab1fcd75c 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/Confirmation.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/Confirmation.java @@ -51,15 +51,27 @@ public class Confirmation { public void onConfirm(CMDSender sender) { Consumer found = awaiting.getIfPresent(sender); if (found == null) throw new IllegalArgumentException("Confirmation expired, use the command again" /* TODO */); - found.accept(true); - awaiting.invalidate(sender); + try { + found.accept(true); + } catch (RuntimeException e) { + sender.send("The accepted action errored upon execution: " + e /* TODO */); + throw e; + } finally { + awaiting.invalidate(sender); + } } public void onCancel(CMDSender sender) { Consumer found = awaiting.getIfPresent(sender); if (found == null) throw new IllegalArgumentException("Confirmation expired, use the command again" /* TODO */); - found.accept(false); - awaiting.invalidate(sender); + try { + found.accept(false); + } catch (RuntimeException e) { + sender.send("The denied action errored upon execution: " + e /* TODO */); + throw e; + } finally { + awaiting.invalidate(sender); + } } public void onAcceptCommand(CMDSender sender, Arguments arguments) {