quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.34k stars 2.55k forks source link

Picocli - Some expected errors lead to a stacktrace and they shouldn't #41513

Open gsmet opened 3 days ago

gsmet commented 3 days ago

In the case of quarkus config enc, if I forget the parameter, I end up with a stacktrace which is not really expected: we should have a standard Picocli error output and not a full stacktrace as this is a standard use case of the CLI and not an underlying error.

$ quarkus config enc
2024-06-27 14:23:25,703 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): picocli.CommandLine$MissingParameterException: Missing required parameter: 'SECRET'
    at picocli.CommandLine$Interpreter.assertNoMissingParameters(CommandLine.java:14930)
    at picocli.CommandLine$Interpreter.validateConstraints(CommandLine.java:13659)
    at picocli.CommandLine$Interpreter.parse(CommandLine.java:13620)
    at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13915)
    at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13811)
    at picocli.CommandLine$Interpreter.parse(CommandLine.java:13597)
    at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13915)
    at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13811)
    at picocli.CommandLine$Interpreter.parse(CommandLine.java:13597)
    at picocli.CommandLine$Interpreter.parse(CommandLine.java:13565)
    at picocli.CommandLine$Interpreter.parse(CommandLine.java:13460)
    at picocli.CommandLine.parseArgs(CommandLine.java:1552)
    at io.quarkus.cli.QuarkusCli.checkMissingCommand(QuarkusCli.java:165)
    at io.quarkus.cli.QuarkusCli.run(QuarkusCli.java:109)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at io.quarkus.cli.Main.main(Main.java:9)
quarkus-bot[bot] commented 3 days ago

/cc @brunobat (opentelemetry,tracing), @ebullient (picocli), @radcortez (opentelemetry,tracing)