Package com.contentful.java.cda
Class CDAHttpException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.contentful.java.cda.CDAHttpException
-
- All Implemented Interfaces:
java.io.Serializable
public class CDAHttpException extends java.lang.RuntimeExceptionThis class will represent known Contentful exceptions- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CDAHttpException(okhttp3.Request request, okhttp3.Response response)Construct an error response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intrateLimitHourLimit()intrateLimitHourRemaining()intrateLimitReset()intrateLimitSecondLimit()intrateLimitSecondRemaining()java.lang.StringresponseBody()intresponseCode()java.lang.StringresponseMessage()java.lang.StringtoString()Convert exception to human readable form.
-
-
-
Constructor Detail
-
CDAHttpException
public CDAHttpException(okhttp3.Request request, okhttp3.Response response)Construct an error response.This constructor will fill the exception with easy accessible values, like
responseCode().responseMessage(), but alsorateLimitReset().- Parameters:
request- the request issuing the error.response- the response from the server to this faulty request.
-
-
Method Detail
-
toString
public java.lang.String toString()
Convert exception to human readable form.- Overrides:
toStringin classjava.lang.Throwable- Returns:
- a string representing this exception.
-
responseCode
public int responseCode()
- Returns:
- the response code of the request.
-
responseMessage
public java.lang.String responseMessage()
- Returns:
- the message the server returned.
-
responseBody
public java.lang.String responseBody()
- Returns:
- the errors body, potentially containing more information.
-
rateLimitHourLimit
public int rateLimitHourLimit()
- Returns:
- the hourly rate limit or -1 if header not send
-
rateLimitHourRemaining
public int rateLimitHourRemaining()
- Returns:
- the number of remaining requests that can be made for the current hour or -1 if header not send
-
rateLimitSecondLimit
public int rateLimitSecondLimit()
- Returns:
- the per second rate limit or -1 if header not send
-
rateLimitSecondRemaining
public int rateLimitSecondRemaining()
- Returns:
- the number of remaining requests that can be made per second or -1 if header not send
-
rateLimitReset
public int rateLimitReset()
- Returns:
- the number of seconds until the user can make their next request or -1 if header not send
-
-