Skip to content

Commit

Permalink
Made change to invoke response listener on all failures
Browse files Browse the repository at this point in the history
Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
  • Loading branch information
Anshu Agarwal committed Oct 6, 2022
1 parent ee839f7 commit 9cb3672
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeReadAction;
import org.opensearch.cluster.ClusterState;
Expand Down Expand Up @@ -85,7 +84,7 @@ protected void clusterManagerOperation(
final ClusterGetWeightedRoutingRequest request,
ClusterState state,
final ActionListener<ClusterGetWeightedRoutingResponse> listener
) throws IOException {
) {
try {
weightedRoutingService.verifyAwarenessAttribute(request.getAwarenessAttribute());
WeightedRoutingMetadata weightedRoutingMetadata = state.metadata().custom(WeightedRoutingMetadata.TYPE);
Expand All @@ -105,10 +104,8 @@ protected void clusterManagerOperation(
clusterGetWeightedRoutingResponse = new ClusterGetWeightedRoutingResponse(weight, weightedRouting);
}
listener.onResponse(clusterGetWeightedRoutingResponse);
} catch (ActionRequestValidationException ex) {
} catch (Exception ex) {
listener.onFailure(ex);
}

}

}

0 comments on commit 9cb3672

Please sign in to comment.