mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
[bs-137] "spring help" prints "Unexpected error" (when it isn't)
[#50523561]
This commit is contained in:
parent
750b193fe4
commit
25f68404f3
@ -84,8 +84,9 @@ public class SpringBootstrapCli {
|
|||||||
Set<BootstrapCliException.Option> options = NO_EXCEPTION_OPTIONS;
|
Set<BootstrapCliException.Option> options = NO_EXCEPTION_OPTIONS;
|
||||||
if (ex instanceof BootstrapCliException) {
|
if (ex instanceof BootstrapCliException) {
|
||||||
options = ((BootstrapCliException) ex).getOptions();
|
options = ((BootstrapCliException) ex).getOptions();
|
||||||
}
|
} else {
|
||||||
errorMessage(ex.getMessage());
|
errorMessage(ex.getMessage());
|
||||||
|
}
|
||||||
if (options.contains(BootstrapCliException.Option.SHOW_USAGE)) {
|
if (options.contains(BootstrapCliException.Option.SHOW_USAGE)) {
|
||||||
showUsage();
|
showUsage();
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,7 @@ public class SpringBootstrapCliTests {
|
|||||||
public void handlesNoSuchOptionException() throws Exception {
|
public void handlesNoSuchOptionException() throws Exception {
|
||||||
int status = this.cli.runAndHandleErrors("--missing");
|
int status = this.cli.runAndHandleErrors("--missing");
|
||||||
assertThat(status, equalTo(1));
|
assertThat(status, equalTo(1));
|
||||||
assertThat(this.calls,
|
assertThat(this.calls, equalTo((Set<Call>) EnumSet.of(Call.SHOW_USAGE)));
|
||||||
equalTo((Set<Call>) EnumSet.of(Call.ERROR_MESSAGE, Call.SHOW_USAGE)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user