# Class ParseException

java.lang.Object
java.lang.Throwable
java.lang.Exception
org.apache.commons.cli.ParseException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `AlreadySelectedException, MissingArgumentException, MissingOptionException, UnrecognizedOptionException`

public class ParseException extends Exception
Base for Exceptions thrown during parsing of a command-line.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParseException(String message)`
  Constructs a new `ParseException` with the specified detail message.
  `ParseException(Throwable e)`
  Constructs a new `ParseException` wrapping the specified exception.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ParseException`
  `wrap(Throwable e)`
  Converts any exception except `UnsupportedOperationException` to a `ParseException`. if `e` is an instance of `ParseException` it is returned, otherwise a `ParseException` is created that wraps it.

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### ParseException

    public ParseException(String message)
    Constructs a new `ParseException` with the specified detail message.
    Parameters:
      `message` - the detail message.

  - ### ParseException

    public ParseException(Throwable e)
    Constructs a new `ParseException` wrapping the specified exception.
    Parameters:
      `e` - the Exception to wrap.

- ## Method Details

  - ### wrap

    public static ParseException wrap(Throwable e) throws UnsupportedOperationException
    Converts any exception except `UnsupportedOperationException` to a `ParseException`. if `e` is an instance of `ParseException` it is returned, otherwise a `ParseException` is created that wraps it.

    Note: `UnsupportedOperationException` are not wrapped. This is to solve a legacy expected exception problem and will be removed in the future.

    Parameters:
      `e` - the exception to convert.
    Returns:
      the ParseException.
    Throws:
      `UnsupportedOperationException` - due to legacy expectations. Will be removed in the future.
    Since:
      1.7.0