public class JsonErrorUnmarshaller extends AbstractErrorUnmarshaller<JSONObject>
exceptionClass| Modifier | Constructor and Description |
|---|---|
|
JsonErrorUnmarshaller() |
protected |
JsonErrorUnmarshaller(java.lang.Class<? extends AmazonServiceException> exceptionClass) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
match(java.lang.String errorTypeFromHeader,
JSONObject json)
Any subclass that is specific to a error type should only return true
when the response matches, either by matching the error type parsed from
header or from the JSON content.
|
java.lang.String |
parseErrorCode(JSONObject json) |
java.lang.String |
parseMember(java.lang.String key,
JSONObject json) |
java.lang.String |
parseMessage(JSONObject json) |
AmazonServiceException |
unmarshall(JSONObject json)
Subclass should override the match(String, JSONObject) method to indicate
whether it represents the given error type, and unmarshall(JSONObject)
should never return null.
|
newExceptionpublic JsonErrorUnmarshaller()
protected JsonErrorUnmarshaller(java.lang.Class<? extends AmazonServiceException> exceptionClass)
public AmazonServiceException unmarshall(JSONObject json) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String parseMessage(JSONObject json) throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String parseMember(java.lang.String key,
JSONObject json)
throws JSONException
JSONExceptionpublic java.lang.String parseErrorCode(JSONObject json) throws java.lang.Exception
java.lang.Exceptionpublic boolean match(java.lang.String errorTypeFromHeader,
JSONObject json)
throws java.lang.Exception
errorTypeFromHeader - The error type parsed from the response headers, or null if
such information is not available in the headers.json - The JSON content of the response. Subclass should check for
the error type information from this JSONObject if
errorTypeFromHeader is null.java.lang.Exception