Skip to content

Custom exception handling for Runnable/Callable  #541

@remkop

Description

@remkop

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions