Source:
public PagesResponse handle(Request request, Response response) { try { if (response.getStatusCode() == HttpStatus.NO_CONTENT.code()) { return createEmptyPagesResponse(getTaskInstanceId(response), getToken(response), getNextToken(response), getComplete(response)); } if (response.getStatusCode() != HttpStatus.OK.code()) { StringBuilder body = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getInputStream(), UTF_8))) { for (int i = 0; i < 1000; i++) { String line = reader.readLine(); if (line == null || body.length() + line.length() > 100 * 1024) { break; } body.append(line + "\n"); } } catch (RuntimeException | IOException e) { } throw new PageTransportErrorException(format("Expected response code to be 200, but was %s %s:%n%s", response.getStatusCode(), response.getStatusMessage(), body.toString())); } String contentType = response.getHeader(CONTENT_TYPE); if (contentType == null) { throw new PageTransportErrorException(format("%s header is not set: %s", CONTENT_TYPE, response)); } if (!mediaTypeMatches(contentType, PRESTO_PAGES_TYPE)) { throw new PageTransportErrorException(format("Expected %s response from server but got %s", PRESTO_PAGES_TYPE, contentType)); } String taskInstanceId = getTaskInstanceId(response); long token = getToken(response); long nextToken = getNextToken(response); boolean complete = getComplete(response); try (SliceInput input = new InputStreamSliceInput(response.getInputStream())) { List<SerializedPage> pages = ImmutableList.copyOf(readSerializedPages(input)); return createPagesResponse(taskInstanceId, token, nextToken, pages, complete); } catch (IOException e) { throw new RuntimeException(e); } } catch (PageTransportErrorException e) { throw new PageTransportErrorException("Error fetching %s " + request.getUri().toASCIIString(), e); } }

Target:
public PagesResponse handle(Request request, Response response) { try { if (response.getStatusCode() == HttpStatus.NO_CONTENT.code()) { return createEmptyPagesResponse(getTaskInstanceId(response), getToken(response), getNextToken(response), getComplete(response)); } if (response.getStatusCode() != HttpStatus.OK.code()) { StringBuilder body = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getInputStream(), UTF_8))) { for (int i = 0; i < 1000; i++) { String line = reader.readLine(); if (line == null || body.length() + line.length() > 100 * 1024) { break; } body.append(line + "\n"); } } catch (RuntimeException | IOException e) { } throw new PageTransportErrorException(format("Expected response code to be 200, but was %s %s:%n%s", response.getStatusCode(), response.getStatusMessage(), body.toString())); } String contentType = response.getHeader(CONTENT_TYPE); if (contentType == null) { throw new PageTransportErrorException(format("%s header is not set: %s", CONTENT_TYPE, response)); } if (!mediaTypeMatches(contentType, PRESTO_PAGES_TYPE)) { throw new PageTransportErrorException(format("Expected %s response from server but got %s", PRESTO_PAGES_TYPE, contentType)); } String taskInstanceId = getTaskInstanceId(response); long token = getToken(response); long nextToken = getNextToken(response); boolean complete = getComplete(response); try (SliceInput input = new InputStreamSliceInput(response.getInputStream())) { List<SerializedPage> pages = ImmutableList.copyOf(readSerializedPages(input)); return createPagesResponse(taskInstanceId, token, nextToken, pages, complete); } catch (IOException e) { throw new RuntimeException(e); } } catch (PageTransportErrorException e) { throw new PageTransportErrorException("Error fetching " + request.getUri().toASCIIString(), e); } }