URL url = config.resolveURL(String.format("data/explore/queries/%s", queryHandle.getHandle()));
HttpResponse response = restClient.execute(HttpMethod.DELETE, url, config.getAccessToken(),
HttpURLConnection.HTTP_NOT_FOUND,
HttpURLConnection.HTTP_BAD_REQUEST);
if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
throw new QueryNotFoundException(queryHandle.getHandle());
} else if (response.getResponseCode() == HttpURLConnection.HTTP_BAD_REQUEST) {
throw new BadRequestException("The query '" + queryHandle + "' was not in a state that could be closed;" +
" either wait until it is finished, or cancel it");
}
}