@Override public JsonErrorResponseHandler createErrorResponseHandler( final List<JsonErrorUnmarshaller> errorUnmarshallers, String customErrorCodeFieldName) { return new JsonErrorResponseHandler(errorUnmarshallers, getErrorCodeParser(customErrorCodeFieldName), JsonErrorMessageParser.DEFAULT_ERROR_MESSAGE_PARSER, jsonFactory); }
private AmazonServiceException handleError(HttpResponse error) throws Exception { List<JsonErrorUnmarshaller> unmarshallers = new LinkedList<JsonErrorUnmarshaller>(); unmarshallers.add(new JsonErrorUnmarshaller(InvalidParameterException.class, ERROR_TYPE)); JsonErrorResponseHandler handler = SdkStructuredIonFactory.SDK_ION_BINARY_FACTORY.createErrorResponseHandler(unmarshallers, NO_CUSTOM_ERROR_CODE_FIELD_NAME); return handler.handle(error); }
protected HttpResponseHandler<AmazonServiceException> stubErrorHandler() throws Exception { HttpResponseHandler<AmazonServiceException> errorHandler = mock(JsonErrorResponseHandler.class); when(errorHandler.handle(any(HttpResponse.class))).thenReturn(mockException()); return errorHandler; }
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke( Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) { JsonErrorResponseHandler errorResponseHandler = new JsonErrorResponseHandler(exceptionUnmarshallers); Response<X> result = client.execute( prepareRequest(request, executionContext), responseHandler, errorResponseHandler, executionContext); return result; }
/** * Returns the error response handler for handling a error response. * * @param errorUnmarshallers Response unmarshallers to unamrshall the error responses. */ JsonErrorResponseHandler createErrorResponseHandler( List<JsonErrorUnmarshaller> errorUnmarshallers, String customErrorCodeFieldName);