@Override public AmazonServiceException handle(HttpResponse httpResponse) throws XMLStreamException { final AmazonServiceException exception = createException(httpResponse); exception.setHttpHeaders(httpResponse.getHeaders()); return exception; }
@Override public AmazonServiceException handle(HttpResponse errorResponse) throws Exception { AmazonServiceException ase = createAse(errorResponse); if (ase == null) { throw new SdkClientException("Unable to unmarshall error response from service"); } ase.setHttpHeaders(errorResponse.getHeaders()); if (StringUtils.isNullOrEmpty(ase.getErrorCode())) { ase.setErrorCode(errorResponse.getStatusCode() + " " + errorResponse.getStatusText()); } return ase; }
@Override public AmazonServiceException handle(HttpResponse response) throws Exception { JsonContent jsonContent = JsonContent.createJsonContent(response, jsonFactory); String errorCode = errorCodeParser.parseErrorCode(response, jsonContent); AmazonServiceException ase = createException(errorCode, jsonContent); // Jackson has special-casing for 'message' values when deserializing // Throwables, but sometimes the service passes the error message in // other JSON fields - handle it here. if (ase.getErrorMessage() == null) { ase.setErrorMessage(errorMessageParser.parseErrorMessage(response, jsonContent.getJsonNode())); } ase.setErrorCode(errorCode); ase.setServiceName(response.getRequest().getServiceName()); ase.setStatusCode(response.getStatusCode()); ase.setErrorType(getErrorTypeFromStatusCode(response.getStatusCode())); ase.setRawResponse(jsonContent.getRawContent()); String requestId = getRequestIdFromHeaders(response.getHeaders()); if (requestId != null) { ase.setRequestId(requestId); } ase.setHttpHeaders(response.getHeaders()); return ase; }
@Override public AmazonServiceException handle(HttpResponse errorResponse) throws Exception { AmazonServiceException ase = createAse(errorResponse); if (ase == null) { throw new SdkClientException("Unable to unmarshall error response from service"); } ase.setHttpHeaders(errorResponse.getHeaders()); if (StringUtils.isNullOrEmpty(ase.getErrorCode())) { ase.setErrorCode(errorResponse.getStatusCode() + " " + errorResponse.getStatusText()); } return ase; }
@Override public AmazonServiceException handle(HttpResponse response) throws Exception { JsonContent jsonContent = JsonContent.createJsonContent(response, jsonFactory); String errorCode = errorCodeParser.parseErrorCode(response, jsonContent); AmazonServiceException ase = createException(errorCode, jsonContent); // Jackson has special-casing for 'message' values when deserializing // Throwables, but sometimes the service passes the error message in // other JSON fields - handle it here. if (ase.getErrorMessage() == null) { ase.setErrorMessage(errorMessageParser.parseErrorMessage(response, jsonContent.getJsonNode())); } ase.setErrorCode(errorCode); ase.setServiceName(response.getRequest().getServiceName()); ase.setStatusCode(response.getStatusCode()); ase.setErrorType(getErrorTypeFromStatusCode(response.getStatusCode())); ase.setRawResponse(jsonContent.getRawContent()); String requestId = getRequestIdFromHeaders(response.getHeaders()); if (requestId != null) { ase.setRequestId(requestId); } ase.setHttpHeaders(response.getHeaders()); return ase; }
@Override public AmazonServiceException handle(HttpResponse httpResponse) throws XMLStreamException { final AmazonServiceException exception = createException(httpResponse); exception.setHttpHeaders(httpResponse.getHeaders()); return exception; }
@Override public AmazonServiceException handle(HttpResponse errorResponse) throws Exception { AmazonServiceException ase = createAse(errorResponse); if (ase == null) { throw new SdkClientException("Unable to unmarshall error response from service"); } ase.setHttpHeaders(errorResponse.getHeaders()); if (StringUtils.isNullOrEmpty(ase.getErrorCode())) { ase.setErrorCode(errorResponse.getStatusCode() + " " + errorResponse.getStatusText()); } return ase; }
@Override public AmazonServiceException handle(HttpResponse response) throws Exception { JsonContent jsonContent = JsonContent.createJsonContent(response, jsonFactory); String errorCode = errorCodeParser.parseErrorCode(response, jsonContent); AmazonServiceException ase = createException(errorCode, jsonContent); // Jackson has special-casing for 'message' values when deserializing // Throwables, but sometimes the service passes the error message in // other JSON fields - handle it here. if (ase.getErrorMessage() == null) { ase.setErrorMessage(errorMessageParser.parseErrorMessage(response, jsonContent.getJsonNode())); } ase.setErrorCode(errorCode); ase.setServiceName(response.getRequest().getServiceName()); ase.setStatusCode(response.getStatusCode()); ase.setErrorType(getErrorTypeFromStatusCode(response.getStatusCode())); ase.setRawResponse(jsonContent.getRawContent()); String requestId = getRequestIdFromHeaders(response.getHeaders()); if (requestId != null) { ase.setRequestId(requestId); } ase.setHttpHeaders(response.getHeaders()); return ase; }