com.thetransactioncompany.jsonrpc2

## Class JSONRPC2ParseException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - com.thetransactioncompany.jsonrpc2.JSONRPC2ParseException

- All Implemented Interfaces:
    Serializable

      public class JSONRPC2ParseException
      extends Exception

  Thrown to indicate an exception during the parsing of a JSON-RPC 2.0 message string.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `JSON` Indicates a parse exception caused by invalid JSON.
    `static int` | `PROTOCOL` Indicates a parse exception caused by a JSON message not conforming to the JSON-RPC 2.0 protocol.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONRPC2ParseException(String message)` Creates a new parse exception with the specified message.
    `JSONRPC2ParseException(String message, int causeType, String unparsableString)` Creates a new parse exception with the specified message, cause type and the original string that didn't parse.
    `JSONRPC2ParseException(String message, String unparsableString)` Creates a new parse exception with the specified message and the original string that didn't parse.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCauseType()` Gets the parse exception cause type.
    `String` | `getUnparsableString()` Gets original string that caused the parse exception (if specified).

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

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

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

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

- - ### Field Detail

    - #### JSON

          public static final int JSON

      Indicates a parse exception caused by invalid JSON.
      See Also:
        Constant Field Values

    - #### PROTOCOL

          public static final int PROTOCOL

      Indicates a parse exception caused by a JSON message not conforming to the JSON-RPC 2.0 protocol.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JSONRPC2ParseException

          public JSONRPC2ParseException(String message)

      Creates a new parse exception with the specified message. The cause type is set to `PROTOCOL`.
      Parameters:
        `message` - The exception message.

    - #### JSONRPC2ParseException

          public JSONRPC2ParseException(String message,
                                        int causeType,
                                        String unparsableString)

      Creates a new parse exception with the specified message, cause type and the original string that didn't parse.
      Parameters:
        `message` - The exception message.
        `causeType` - The exception cause type, either `PROTOCOL` or `JSON`.
        `unparsableString` - The unparsable string.

    - #### JSONRPC2ParseException

          public JSONRPC2ParseException(String message,
                                        String unparsableString)

      Creates a new parse exception with the specified message and the original string that didn't parse. The cause type is set to `PROTOCOL`.
      Parameters:
        `message` - The exception message.
        `unparsableString` - The unparsable string.

  - ### Method Detail

    - #### getCauseType

          public int getCauseType()

      Gets the parse exception cause type.
      Returns:
        The cause type, either `PROTOCOL` or `JSON`.

    - #### getUnparsableString

          public String getUnparsableString()

      Gets original string that caused the parse exception (if specified).
      Returns:
        The string that didn't parse, `null` if none.