in data/src/main/java/com/microsoft/azure/kusto/data/auth/CloudInfo.java [135:157]
private static Mono<CloudInfo> getCloudInfo(HttpResponse response, String clusterUrl) {
int statusCode = response.getStatusCode();
return Utils.getResponseBody(response)
.handle((content, sink) -> {
if (statusCode == HttpStatus.OK) {
if (content.isEmpty() || content.equals("{}")) {
sink.error(new DataServiceException(clusterUrl, "Error in metadata endpoint, received no data", true));
return;
}
sink.next(parseCloudInfo(content));
} else if (statusCode == HttpStatus.NOT_FOUND) {
sink.next(DEFAULT_CLOUD);
} else {
String errorFromResponse = content;
if (errorFromResponse.isEmpty()) {
// Fixme: Missing reason phrase to add to exception. Potentially want to use an enum.
errorFromResponse = "";
}
sink.error(new DataServiceException(clusterUrl, "Error in metadata endpoint, got code: " + statusCode +
"\nWith error: " + errorFromResponse, statusCode != HttpStatus.TOO_MANY_REQS));
}
});
}