Skip to content

Commit

Permalink
Catch exceptions when running checkMissingCommand
Browse files Browse the repository at this point in the history
We want to check for the missing commands only, any other error will
have to be handled by Picocli later (and thus will properly handle the
formatting of the feedback and avoid a stacktrace).

Fixes #41513

(cherry picked from commit f2455e3)
  • Loading branch information
gsmet committed Jul 2, 2024
1 parent 9fa1a1e commit 61c62fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ public Optional<String> checkMissingCommand(CommandLine root, String[] args) {
return Optional.empty();
} catch (UnmatchedArgumentException e) {
return Optional.of(args[0]);
} catch (Exception e) {
// For any other exceptions (e.g. MissingParameterException), we should just ignore.
// The problem is not that the command is missing but that the options might not be adequate.
// This will be handled by Picocli at a later step.
return Optional.empty();
}
}

Expand Down

0 comments on commit 61c62fc

Please sign in to comment.