airlift / airline

Java annotation-based framework for parsing Git like command line structures
Apache License 2.0
847 stars 138 forks source link

Improve error messages on bad command #17

Open cheddar opened 11 years ago

cheddar commented 11 years ago

I just ran

java_stuff server overlord

and got

Exception in thread "main" io.airlift.command.ParseArgumentsUnexpectedException: Found unexpected parameters: [overlord]
    at io.airlift.command.Cli.validate(Cli.java:148)
    at io.airlift.command.Cli.parse(Cli.java:116)
    at io.airlift.command.Cli.parse(Cli.java:97)
    at io.druid.cli.Main.main(Main.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Which is a pretty poor error message for a user to see. Something like, "server overlord is unknown, known options are XXX" would be what I would like users to see.