/** * Subclass should override the match(String, JSONObject) method to indicate * whether it represents the given error type, and unmarshall(JSONObject) * should never return null. */ @Override public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception { String message = error.getMessage(); String errorCode = error.getErrorCode(); if ((null == message || message.isEmpty()) && (null == errorCode || errorCode.isEmpty())) { /** * Trigger the catch block in AmazonHttpClient.handleErrorResponse * to handle 413 and 503 errors */ throw new AmazonClientException( "Neither error message nor error code is found in the error response payload."); } else { AmazonServiceException ase = newException(message); ase.setErrorCode(errorCode); return ase; } }
/** * Subclass should override the match(String, JSONObject) method to indicate * whether it represents the given error type, and unmarshall(JSONObject) * should never return null. */ @Override public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception { String message = error.getMessage(); String errorCode = error.getErrorCode(); if ((null == message || message.isEmpty()) && (null == errorCode || errorCode.isEmpty())) { /** * Trigger the catch block in AmazonHttpClient.handleErrorResponse * to handle 413 and 503 errors */ throw new AmazonClientException( "Neither error message nor error code is found in the error response payload."); } else { AmazonServiceException ase = newException(message); ase.setErrorCode(errorCode); return ase; } }
/** * Subclass should override the match(String, JSONObject) method to indicate * whether it represents the given error type, and unmarshall(JSONObject) * should never return null. */ @Override public AmazonServiceException unmarshall(JsonErrorResponse error) throws Exception { String message = error.getMessage(); String errorCode = error.getErrorCode(); if ((null == message || message.isEmpty()) && (null == errorCode || errorCode.isEmpty())) { /** * Trigger the catch block in AmazonHttpClient.handleErrorResponse * to handle 413 and 503 errors */ throw new AmazonClientException( "Neither error message nor error code is found in the error response payload."); } else { AmazonServiceException ase = newException(message); ase.setErrorCode(errorCode); return ase; } }