-
Notifications
You must be signed in to change notification settings - Fork 397
Closed as duplicate of#1285
Description
What?
If a command throws an exception I would assume that the exception message is printed as the default behavior.
Current behavior
If an exception is thrown the exception message is not printed:
shell:>some command --someOption TEST
Unable to run command some: null
Wanted behavior
The error message should contain the exception message, for example:
shell:>some command --someOption TEST
Unable to run command some: some error message
Alternatively it would be ok, if it was possible to define a default exception handler for all commands. It seems it is only possible to define a exitStatusExceptionMapper on command level. Otherwise it would be necessary to add try catch blocks to all commands only to print the exception error message.
Code references
Relevant code seems to be in InteractiveShellRunner:
catch (CommandExecutionException executionException) { // technical error
Throwable cause = executionException.getCause();
String errorMessage = "Unable to run command " + parsedInput.commandName();
print(cause == null ? errorMessage : errorMessage + ": " + cause.getMessage());
...
}
cause.getMessage() seems to be null here. It would be better to print the root cause.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels