RESTException (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.rest

## Class RESTException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - com.ibm.streamsx.rest.RESTException

- All Implemented Interfaces:
    java.io.Serializable

      public class RESTException
      extends java.io.IOException

  Exception for REST api wrappers
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RESTException(int code, java.lang.String message)` Customized exception that can provide more information on REST errors
    `RESTException(int code)` Customized exception that can provide more information on REST errors
    `RESTException(java.lang.String message, java.lang.Exception exception)` Customized exception that can provide more information on REST errors
    `RESTException(java.lang.String message)` Customized exception that can provide more information on REST errors

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RESTException` | `create(int code, java.lang.String streamsMessage)` Customized exception that can provide more information on REST errors
    `int` | `getStatusCode()` Gets the error status code for this exception
    `com.google.gson.JsonObject` | `getStreamsErrorMessageAsJson()` Gets the IBM Streams message for this exception as a Json Object
    `java.lang.String` | `getStreamsErrorMessageId()` Gets the IBM Streams message ID for this exception

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

- - ### Constructor Detail

    - #### RESTException

          public RESTException(int code)

      Customized exception that can provide more information on REST errors
      Parameters:
        `code` - - error message code (currently will contain only HTTP response codes)

    - #### RESTException

          public RESTException(int code,
                               java.lang.String message)

      Customized exception that can provide more information on REST errors
      Parameters:
        `code` - - error message code
        `message` - - error message to be seen

    - #### RESTException

          public RESTException(java.lang.String message)

      Customized exception that can provide more information on REST errors
      Parameters:
        `message` - - error message to be seen

    - #### RESTException

          public RESTException(java.lang.String message,
                               java.lang.Exception exception)

      Customized exception that can provide more information on REST errors
      Parameters:
        `message` - - error message to be seen
        `exception` - - cause

  - ### Method Detail

    - #### create

          public static final RESTException create(int code,
                                                   java.lang.String streamsMessage)

      Customized exception that can provide more information on REST errors
      Parameters:
        `code` - - error message code (matches HTTP response codes)
      Returns:
        a `RESTException` created from a code and an IBM Streams Message

    - #### getStatusCode

          public int getStatusCode()

      Gets the error status code for this exception
      Returns:
        the error status code

    - #### getStreamsErrorMessageId

          public java.lang.String getStreamsErrorMessageId()

      Gets the IBM Streams message ID for this exception
      Returns:
        the IBM Streams message ID

    - #### getStreamsErrorMessageAsJson

          public com.google.gson.JsonObject getStreamsErrorMessageAsJson()

      Gets the IBM Streams message for this exception as a Json Object
      Returns:
        the IBM Streams message as a `JsonObject`