CommandLine.DefaultExceptionHandler (picocli 2.3.0 API)
Date: 2018-02-13

picocli

## Class CommandLine.DefaultExceptionHandler

- java.lang.Object
- - picocli.CommandLine.DefaultExceptionHandler

- All Implemented Interfaces:
    CommandLine.IExceptionHandler
  Enclosing class:
    CommandLine

      public static class CommandLine.DefaultExceptionHandler
      extends java.lang.Object
      implements CommandLine.IExceptionHandler

  Default exception handler that prints the exception message to the specified `PrintStream`, followed by the usage message for the command or subcommand whose input was invalid.

  Implementation roughly looks like this:

           System.err.println(paramException.getMessage());
           paramException.getCommandLine().usage(System.err);

  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommandLine.DefaultExceptionHandler()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<java.lang.Object>` | `handleException(CommandLine.ParameterException ex, java.io.PrintStream out, CommandLine.Help.Ansi ansi, java.lang.String... args)` Handles a `ParameterException` that occurred while parsing the command line arguments and optionally returns a list of results.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CommandLine.DefaultExceptionHandler

          public CommandLine.DefaultExceptionHandler()

  - ### Method Detail

    - #### handleException

          public java.util.List<java.lang.Object> handleException(CommandLine.ParameterException ex,
                                                         java.io.PrintStream out,
                                                         CommandLine.Help.Ansi ansi,
                                                         java.lang.String... args)

      Description copied from interface: `CommandLine.IExceptionHandler`
      Handles a `ParameterException` that occurred while parsing the command line arguments and optionally returns a list of results.
      Specified by:
        `handleException` in interface `CommandLine.IExceptionHandler`
      Parameters:
        `ex` - the ParameterException describing the problem that occurred while parsing the command line arguments, and the CommandLine representing the command or subcommand whose input was invalid
        `out` - the `PrintStream` to print help to if requested
        `ansi` - for printing help messages using ANSI styles and colors
        `args` - the command line arguments that could not be parsed
      Returns:
        a list of results, or an empty list if there are no results