public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toString(from.getPayload()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toString(from.getPayload()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
@Override public void handleError(HttpCommand command, HttpResponse response) { B2Error error = this.apply(response); Exception exception = refineException(error, new B2ResponseException(command, response, error)); command.setException(exception); } }
public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toString(from.getPayload()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
@Override public void handleError(HttpCommand command, HttpResponse response) { B2Error error = this.apply(response); Exception exception = refineException(error, new B2ResponseException(command, response, error)); command.setException(exception); } }
@Override public void handleError(HttpCommand command, HttpResponse response) { B2Error error = this.apply(response); Exception exception = refineException(error, new B2ResponseException(command, response, error)); command.setException(exception); } }
@Override public void handleError(HttpCommand command, HttpResponse response) { B2Error error = this.apply(response); Exception exception = refineException(error, new B2ResponseException(command, response, error)); command.setException(exception); } }
public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toStringAndClose(from.getPayload().openStream()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toStringAndClose(from.getPayload().openStream()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
public void handleError(HttpCommand command, HttpResponse from) { String content; try { content = from.getPayload() != null ? Strings2.toStringAndClose(from.getPayload().openStream()) : null; command.setException(new HttpResponseException(command, from, content)); } catch (IOException e) { command.setException(new HttpResponseException(command, from)); } finally { releasePayload(from); } } }
@Override public void handleError(HttpCommand command, HttpResponse response) { Exception exception = new HttpResponseException(command, response); try { if (response.getPayload() != null) { AWSError error = factory.create(handlers.get()) .parse(new String(closeClientButKeepContentStream(response))); exception = refineException(new AWSResponseException(command, response, error)); } } finally { releasePayload(response); command.setException(exception); } }
@Override public void handleError(HttpCommand command, HttpResponse response) { Exception exception = new HttpResponseException(command, response); try { if (response.getPayload() != null) { AWSError error = factory.create(handlers.get()) .parse(new String(closeClientButKeepContentStream(response))); exception = refineException(new AWSResponseException(command, response, error)); } } finally { releasePayload(response); command.setException(exception); } }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { SoftLayerErrorHandler function = Guice.createInjector().getInstance(SoftLayerErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { CloudSigmaErrorHandler function = Guice.createInjector().getInstance(CloudSigmaErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { GleSYSErrorHandler function = Guice.createInjector().getInstance(GleSYSErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { ElasticStackErrorHandler function = Guice.createInjector().getInstance(ElasticStackErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { CloudStackErrorHandler function = Guice.createInjector().getInstance(CloudStackErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { SoftLayerErrorHandler function = Guice.createInjector().getInstance(SoftLayerErrorHandler.class); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
protected void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { HttpErrorHandler function = Guice.createInjector(new SaxParserModule()).getInstance(getHandlerClass()); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); if (contentType != null) response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }
private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType, String content, Class<? extends Exception> expected) { GoogleComputeEngineErrorHandler function = new GoogleComputeEngineErrorHandler(); HttpCommand command = createMock(HttpCommand.class); HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build(); HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build(); response.getPayload().getContentMetadata().setContentType(contentType); expect(command.getCurrentRequest()).andReturn(request).atLeastOnce(); command.setException(classEq(expected)); replay(command); function.handleError(command, response); verify(command); }