@@ -0,0 +1,2208 @@
+package picocli.examples.exceptionhandler;%0A%0Aimport picocli.CommandLine;%0Aimport picocli.CommandLine.Command;%0Aimport picocli.CommandLine.IExecutionExceptionHandler;%0Aimport picocli.CommandLine.Option;%0Aimport picocli.CommandLine.ParseResult;%0A%0Aimport java.util.concurrent.Callable;%0A%0A@Command%0Apublic class ExecutionExceptionHandlerDemo2 implements Callable%3CInteger%3E %7B%0A%0A    @Option(names = %7B%22-v%22, %22--verbose%22%7D)%0A    boolean%5B%5D verbosity = new boolean%5B0%5D;%0A%0A    @Override%0A    public Integer call() %7B%0A        throw new IllegalStateException(%22Business exception with end user specific message%22);%0A    %7D%0A%0A    // The default IExecutionExceptionHandler will rethrow the exception;%0A    // this results in the exception stack trace being printed to STDERR.%0A%0A    // This example shows how to print the exception message and the usage help message instead.%0A%0A    public static void main(String%5B%5D args) %7B%0A        IExecutionExceptionHandler errorHandler = new IExecutionExceptionHandler() %7B%0A            public int handleExecutionException(Exception ex,%0A                                                CommandLine commandLine,%0A                                                ParseResult parseResult) %7B%0A                commandLine.getErr().println(ex.getMessage());%0A%0A                ExecutionExceptionHandlerDemo2 app = commandLine.getCommand();%0A                System.out.printf(%22app.verbosity.length=%25d%25n%22, app.verbosity.length);%0A                if (app.verbosity.length %3E= 2) %7B%0A                    ex.printStackTrace();%0A                %7D%0A%0A                // alternatively, we can get the verbosity from the parse result:%0A                boolean%5B%5D verbosity = parseResult.matchedOptionValue(%22verbose%22, new boolean%5B0%5D);%0A                System.out.printf(%22parseResult.matchedOption(verbose).length=%25d%25n%22, verbosity.length);%0A                if (verbosity.length %3E= 1) %7B%0A                    commandLine.usage(commandLine.getErr());%0A                %7D%0A                return commandLine.getCommandSpec().exitCodeOnExecutionException();%0A            %7D%0A        %7D;%0A        new CommandLine(new ExecutionExceptionHandlerDemo2())%0A                .setExecutionExceptionHandler(errorHandler)%0A                .execute(%22--verbose%22, %22-vvv%22);%0A    %7D%0A%7D%0A

add example `IExecutionExceptionHandler`