use of com.linkedin.r2.message.rest.RestException in project incubator-gobblin by apache.
the class R2Client method sendRequestImpl.
@Override
public RestResponse sendRequestImpl(RestRequest request) throws IOException {
Future<RestResponse> responseFuture = client.restRequest(request);
RestResponse response;
try {
response = responseFuture.get();
} catch (InterruptedException | ExecutionException e) {
// The service may choose to throw an exception as a way to report error
Throwable t = e.getCause();
if (t != null && t instanceof RestException) {
response = ((RestException) t).getResponse();
} else {
throw new IOException(e);
}
}
return response;
}
Aggregations