From eed6f43aea51560b5e74cb72abf05c6a94774b7a Mon Sep 17 00:00:00 2001 From: Emmanuel Bigeon Date: Sun, 12 Jun 2016 23:02:03 -0400 Subject: [PATCH] Fixed error message for SubedCommand run exceptions --- gclc/src/main/java/fr/bigeon/gclc/command/ScriptExecution.java | 3 +-- gclc/src/main/java/fr/bigeon/gclc/command/SubedCommand.java | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gclc/src/main/java/fr/bigeon/gclc/command/ScriptExecution.java b/gclc/src/main/java/fr/bigeon/gclc/command/ScriptExecution.java index 6d122c2..11952fc 100644 --- a/gclc/src/main/java/fr/bigeon/gclc/command/ScriptExecution.java +++ b/gclc/src/main/java/fr/bigeon/gclc/command/ScriptExecution.java @@ -113,8 +113,7 @@ public class ScriptExecution extends Command { e.getLocalizedMessage() + ")", //$NON-NLS-1$ e, this); } catch (IOException e) { - throw new CommandRunException( - "Unable to read script (" + e.getLocalizedMessage() + ")", //$NON-NLS-1$ //$NON-NLS-2$ + throw new CommandRunException("Unable to read script", //$NON-NLS-1$ e, this); } } diff --git a/gclc/src/main/java/fr/bigeon/gclc/command/SubedCommand.java b/gclc/src/main/java/fr/bigeon/gclc/command/SubedCommand.java index 46de380..569509d 100644 --- a/gclc/src/main/java/fr/bigeon/gclc/command/SubedCommand.java +++ b/gclc/src/main/java/fr/bigeon/gclc/command/SubedCommand.java @@ -122,6 +122,9 @@ public class SubedCommand implements ICommandProvider, ICommand { try { executeSub(args[0], Arrays.copyOfRange(args, 1, args.length)); } catch (CommandRunException e) { + if (e.getSource() != null) { + throw e; + } throw new CommandRunException(CommandRunExceptionType.USAGE, e.getLocalizedMessage(), e, this); }