public abstract class AbstractAPIRequestException
extends java.lang.Exception
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
apiName
The Api name.
|
protected int |
apiResponseCode
The Api response code.
|
protected java.lang.String |
apiResponseMessage
The Api response message.
|
protected static java.lang.String |
CODE_KEY
The constant CODE_KEY.
|
protected com.mashape.unirest.http.HttpResponse<java.io.InputStream> |
httpResponse
The Http response.
|
protected static java.lang.String |
MESSAGE_KEY
The constant MESSAGE_KEY.
|
protected int |
requestStatusCode
The Request code.
|
protected java.lang.String |
requestStatusText
The Request status text.
|
| Constructor and Description |
|---|
AbstractAPIRequestException(java.lang.String apiName,
com.mashape.unirest.http.HttpResponse<java.io.InputStream> httpResponse)
Instantiates a new Abstract api request exception.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getAPIResponseCode()
Gets api response code.
|
java.lang.String |
getAPIResponseMessage()
Gets api response message.
|
java.lang.String |
getMessage() |
int |
getRequestStatusCode()
Gets request status code.
|
java.lang.String |
getRequestStatusText()
Gets request status text.
|
protected abstract void |
parseAPIExceptionMessage()
Parse the API exception message to populate the following fields:
|
protected void |
parseStandardAPIExceptionResponse()
Parse a standard API exception response.
|
protected static final java.lang.String CODE_KEY
protected static final java.lang.String MESSAGE_KEY
protected final java.lang.String apiName
protected com.mashape.unirest.http.HttpResponse<java.io.InputStream> httpResponse
protected int requestStatusCode
protected java.lang.String requestStatusText
protected int apiResponseCode
protected java.lang.String apiResponseMessage
public AbstractAPIRequestException(java.lang.String apiName,
com.mashape.unirest.http.HttpResponse<java.io.InputStream> httpResponse)
apiName - the api namehttpResponse - the http responseprotected abstract void parseAPIExceptionMessage()
requestStatusCode, requestStatusText,
apiResponseCode, apiResponseMessage
protected void parseStandardAPIExceptionResponse()
The following format is parsed:
{
"code": 40010001,
"message": "Error message"
}
public java.lang.String getMessage()
getMessage in class java.lang.Throwablepublic int getRequestStatusCode()
public java.lang.String getRequestStatusText()
public int getAPIResponseCode()
public java.lang.String getAPIResponseMessage()