Skip to content

Commit 25f6840

Browse files
author
Dave Syer
committed
[bs-137] "spring help" prints "Unexpected error" (when it isn't)
[#50523561]
1 parent 750b193 commit 25f6840

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-bootstrap-cli/src/main/java/org/springframework/bootstrap/cli/SpringBootstrapCli.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ public int runAndHandleErrors(String... args) {
8484
Set<BootstrapCliException.Option> options = NO_EXCEPTION_OPTIONS;
8585
if (ex instanceof BootstrapCliException) {
8686
options = ((BootstrapCliException) ex).getOptions();
87+
} else {
88+
errorMessage(ex.getMessage());
8789
}
88-
errorMessage(ex.getMessage());
8990
if (options.contains(BootstrapCliException.Option.SHOW_USAGE)) {
9091
showUsage();
9192
}

spring-bootstrap-cli/src/test/java/org/springframework/bootstrap/cli/SpringBootstrapCliTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ public void handlesNoArgumentsException() throws Exception {
124124
public void handlesNoSuchOptionException() throws Exception {
125125
int status = this.cli.runAndHandleErrors("--missing");
126126
assertThat(status, equalTo(1));
127-
assertThat(this.calls,
128-
equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE, Call.SHOW_USAGE)));
127+
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.SHOW_USAGE)));
129128
}
130129

131130
@Test

0 commit comments

Comments
 (0)