# Class InvalidParameterException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalStateException
org.apache.tomcat.util.http.InvalidParameterException

All Implemented Interfaces:
  `Serializable`

public class InvalidParameterException extends IllegalStateException
Extend `IllegalStateException` to identify the cause as an invalid parameter.

Implementation note: This class extends `IllegalStateException` since that is the class that the Servlet 6.1 onwards Javadocs define is thrown by the various `ServletRequest.getParameterXXX()` methods.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InvalidParameterException(String message)`
  Construct a new exception with the given message.
  `InvalidParameterException(String message, int errorCode)`
  Construct a new exception with the given message and error code.
  `InvalidParameterException(String message, Throwable cause)`
  Construct a new exception with the given message and cause.
  `InvalidParameterException(Throwable cause)`
  Construct a new exception with the given cause.
  `InvalidParameterException(Throwable cause, int errorCode)`
  Construct a new exception with the given cause and error code.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getErrorCode()`
  Get the HTTP error code associated with this exception.

  ### 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

  - ### InvalidParameterException

    public InvalidParameterException(String message)
    Construct a new exception with the given message.
    Parameters:
      `message` - The message to use for the exception

  - ### InvalidParameterException

    public InvalidParameterException(String message, int errorCode)
    Construct a new exception with the given message and error code.
    Parameters:
      `message` - The message to use for the exception
      `errorCode` - The HTTP status code to use when reporting this error. Expected to be >= 400.

  - ### InvalidParameterException

    public InvalidParameterException(String message, Throwable cause)
    Construct a new exception with the given message and cause.
    Parameters:
      `message` - The message to use for the exception
      `cause` - The exception to use as the cause of this exception

  - ### InvalidParameterException

    public InvalidParameterException(Throwable cause)
    Construct a new exception with the given cause. The message for this exception will be generated by calling `cause.toString()`.
    Parameters:
      `cause` - The exception to use as the cause of this exception

  - ### InvalidParameterException

    public InvalidParameterException(Throwable cause, int errorCode)
    Construct a new exception with the given cause and error code. The message for this exception will be generated by calling `cause.toString()`.
    Parameters:
      `cause` - The exception to use as the cause of this exception
      `errorCode` - The HTTP status code to use when reporting this error. Expected to be >= 400.

- ## Method Details

  - ### getErrorCode

    public int getErrorCode()
    Get the HTTP error code associated with this exception.
    Returns:
      the HTTP error code