Skip to content

Commit

Permalink
removes try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebanasios committed Dec 7, 2024
1 parent 50c4598 commit 15f7026
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import org.apache.commons.lang3.StringUtils;
import org.apache.http.ParseException;
Expand Down Expand Up @@ -422,23 +423,19 @@ private Mono<InputStream> executeStreamingQueryAsync(@NotNull KustoRequest kr) {

private Mono<InputStream> executeStreamingQuery(String clusterEndpoint, KustoRequest kr,
HttpTracing tracing, String authorizationToken) {
try {
return Mono.fromCallable(() -> {
HttpRequest request = HttpRequestBuilder
.newPost(clusterEndpoint)
.createCommandPayload(kr)
.withTracing(tracing)
.withAuthorization(authorizationToken)
.build();
long timeoutMs = determineTimeout(kr.getProperties(), kr.getCommandType(), clusterUrl);

// Get the response and trace the call
return MonitoredActivity.wrap(
postToStreamingOutputAsync(request, timeoutMs, 0,
kr.getProperties().getRedirectCount()),
"ClientImpl.executeStreamingQuery", updateAndGetExecuteTracingAttributes(kr.getDatabase(), kr.getProperties()));
} catch (Exception e) {
return Mono.error(e);
}
}).flatMap(Function.identity());
}

private long determineTimeout(ClientRequestProperties properties, CommandType commandType, String clusterUrl) throws DataClientException {
Expand Down

0 comments on commit 15f7026

Please sign in to comment.