public class ErrorResponse extends ServiceResponse
ServiceResponse that may be used to parse body of response send by a server that
contains an ErrorResponse.Error object.
{
"error": {
"code": 486,
"message": "Item not found on the server!"
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
ErrorResponse.Error
Simple error object that can hold two attributes:
Error#code and Error#message. |
| Modifier and Type | Field and Description |
|---|---|
ErrorResponse.Error |
error
Error specified for this response during its initialization or parsed using Gson.
|
NO_REQUEST, NO_SERVICE| Constructor and Description |
|---|
ErrorResponse()
Creates a new instance of ErrorResponse without error.
|
ErrorResponse(ErrorResponse.Error error)
Creates a new instance of ErrorResponse with the specified error.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getErrorCode()
Returns the code of the error (if any) of this response.
|
String |
getErrorMessage()
Returns the message of the error (if any) of this response.
|
String |
toString() |
getRequestId, getServiceId, setRequestId, setServiceIdpublic ErrorResponse.Error error
public ErrorResponse()
This constructor should be used only by Gson library.
public ErrorResponse(@NonNull ErrorResponse.Error error)
error - The error for the new error response.public int getErrorCode()
0 if there is no error presented.@NonNull public String getErrorMessage()
"" if there is no error presented.