Package de.saibotk.jmaw
Class ApiResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
de.saibotk.jmaw.ApiResponseException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TooManyRequestsException
This represents an API exception, for example when the server responds with an HTTP 400 message.
The instance will yield the response associated with the exception.
- Since:
- 1.0
- See Also:
-
Field Summary
-
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
response
public final transient retrofit2.Response response
-
-
Method Details
-
getStatusCode
public int getStatusCode()This will yield the HTTP status code for the associated response.- Returns:
- the status code.
- Since:
- 1.0
-
getErrorBody
public okhttp3.ResponseBody getErrorBody()This will yield the error body from the response.- Returns:
- the error body.
- Since:
- 1.0
-
getApiError
Returns the API's response parsed as aApiError
object, if it contains the typical error and errorMessage fields.- Returns:
- the parsed
ApiError
object. - Since:
- 1.0
-