-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Milestone
Description
The current convenience API doesn’t make it easy to have different exit codes for different exceptions. The most convenient API is to invoke CommandLine.run(new MyRunnable(), args) in the main method, but this doesn’t let you specify an exit code. The parseWithHandlers method gives more control but is more clunky and doesn’t allow different exit codes for different exceptions.
One idea is to let the Runnable/Callable handle the exception if it implements the IExceptionHandler2 interface.
This interface could potentially be split into two super interfaces IParameterExceptionHandler and IExecutionExceptionHandler to allow applications to handle only some exceptions and use the default exception handler for the rest.
Related: #424