mjsax commented on code in PR #20293:
URL: https://github.com/apache/kafka/pull/20293#discussion_r2404154804


##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -95,15 +102,28 @@ public static void main(String[] args) {
                 opts.deleteOffsetsOpt
             ).filter(opts.options::has).count();
             if (numberOfActions != 1)
-                CommandLineUtils.printUsageAndExit(opts.parser, "Command must 
include exactly one action: --list, --describe, --delete, --reset-offsets, or 
--delete-offsets.");
+                throw new IllegalArgumentException("Command must include 
exactly one action: --list, --describe, --delete, --reset-offsets, or 
--delete-offsets.");
 
             run(opts);
-        } catch (OptionException e) {
-            CommandLineUtils.printUsageAndExit(opts.parser, e.getMessage());
+        } catch (IllegalArgumentException | OptionException e) {
+            System.err.println(e.getMessage());
+            if (opts != null) {
+                try {
+                    opts.parser.printHelpOn(System.err);
+                } catch (IOException ex) {
+                    throw new RuntimeException(ex);

Review Comment:
   I don't think we should re-throw here, but only print the stack-trace? If we 
re-throw here, we won't set `exitcode = 1`, and this exception is not called 
anywhere, but bubble out of `main()` and we don't call 
`Exit.exit(execute(args));` as intended.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to