Class ApiException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.bandwidth.exceptions.ApiException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ApiErrorResponseException, ErrorException, ErrorWithRequestException, ForbiddenRequestException, MessagingException, UnauthorizedRequestException

public class ApiException
extends java.lang.Exception
This is the base class for all exceptions that represent an error response from the server.
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    ApiException​(java.lang.String reason)
    Initialization constructor.
    ApiException​(java.lang.String reason, HttpContext context)
    Initialization constructor.
  • Method Summary

    Modifier and Type Method Description
    HttpContext getHttpContext()
    The HTTP response body from the API request.
    int getResponseCode()
    The HTTP response code from the API request.

    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 Details

    • ApiException

      public ApiException​(java.lang.String reason)
      Initialization constructor.
      Parameters:
      reason - The reason for throwing exception
    • ApiException

      public ApiException​(java.lang.String reason, HttpContext context)
      Initialization constructor.
      Parameters:
      reason - The reason for throwing exception
      context - The http context of the API exception
  • Method Details

    • getResponseCode

      public int getResponseCode()
      The HTTP response code from the API request.
      Returns:
      Returns the response code for ApiException
    • getHttpContext

      public HttpContext getHttpContext()
      The HTTP response body from the API request.
      Returns:
      Returns the object of HttpContext for ApiException