Package com.contentful.java.cma.model
Class CMAHttpException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.contentful.java.cma.model.CMAHttpException
-
- All Implemented Interfaces:
java.io.Serializable
public class CMAHttpException extends java.lang.RuntimeExceptionThis class will represent known Contentful exceptions- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCMAHttpException.ErrorBodyError body potentially delivered with an error request.
-
Constructor Summary
Constructors Constructor Description CMAHttpException(okhttp3.Request request, okhttp3.Response response)Construct an error response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMAHttpException.ErrorBodygetErrorBody()intrateLimitHourLimit()intrateLimitHourRemaining()intrateLimitReset()intrateLimitSecondLimit()intrateLimitSecondRemaining()intresponseCode()java.lang.StringresponseMessage()java.lang.StringtoString()Convert exception to human readable form.
-
-
-
Constructor Detail
-
CMAHttpException
public CMAHttpException(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.
-
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 in the 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 a next request or -1 if header not send
-
getErrorBody
public CMAHttpException.ErrorBody getErrorBody()
- Returns:
- a modeled error body response.
-
-