Class HttpRequestException

All Implemented Interfaces:
Serializable

public class HttpRequestException extends ApiException

This exception will occur when the api accepted the request but returned a HTTP status 400 or above.

You can get the HTTP status code via getHttpResponseCode(). Some helpers methods are present to handle some cases:

Sometimes, you will get more information via the getErrorResponse() method. This exposes a reason and message property. For more information, consult the api documentation.

See Also:
  • Constructor Details

    • HttpRequestException

      protected HttpRequestException(int httpResponseCode, Error errorResponse)
  • Method Details

    • getErrorResponse

      public Error getErrorResponse()
      Returns more information linked with the request exception. Can be null.
    • isForbidden

      public boolean isForbidden()
      Indicates if the request is forbidden (http 403).
    • isUnauthorized

      public boolean isUnauthorized()
      Indicates if the request is unauthorized (http 401).
    • isBadRequest

      public boolean isBadRequest()
      Indicates if the request is a bad request (http 400).
    • getHttpResponseCode

      public int getHttpResponseCode()
      Returns the http status code.