Skip to content

Commit 04149a4

Browse files
Address review comment: rename exception
1 parent 8ef049f commit 04149a4

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

server/src/main/java/org/elasticsearch/ElasticsearchException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.apache.lucene.store.LockObtainFailedException;
1717
import org.elasticsearch.action.bulk.IndexDocFailureStoreStatus;
1818
import org.elasticsearch.action.support.replication.ReplicationOperation;
19-
import org.elasticsearch.cluster.RemoteComputeException;
19+
import org.elasticsearch.cluster.RemoteException;
2020
import org.elasticsearch.cluster.action.shard.ShardStateAction;
2121
import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper;
2222
import org.elasticsearch.common.io.stream.StreamInput;
@@ -1984,8 +1984,8 @@ private enum ElasticsearchExceptionHandle {
19841984
TransportVersions.V_8_16_0
19851985
),
19861986
REMOTE_COMPUTE_EXCEPTION(
1987-
RemoteComputeException.class,
1988-
RemoteComputeException::new,
1987+
RemoteException.class,
1988+
RemoteException::new,
19891989
184,
19901990
TransportVersions.REMOTE_COMPUTE_EXCEPTION
19911991
);

server/src/main/java/org/elasticsearch/cluster/RemoteComputeException.java renamed to server/src/main/java/org/elasticsearch/cluster/RemoteException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
* Represents an error that occurred on a remote node.
2222
* It allows capturing some context such as the cluster alias that encountered the error.
2323
*/
24-
public class RemoteComputeException extends ElasticsearchException {
24+
public class RemoteException extends ElasticsearchException {
2525

2626
/**
2727
* @param clusterAlias Name of the cluster.
2828
* @param cause Error that was encountered.
2929
*/
30-
public RemoteComputeException(String clusterAlias, Throwable cause) {
30+
public RemoteException(String clusterAlias, Throwable cause) {
3131
super("Remote [" + clusterAlias + "] encountered an error", cause);
3232
Objects.requireNonNull(cause);
3333
}
3434

35-
public RemoteComputeException(StreamInput in) throws IOException {
35+
public RemoteException(StreamInput in) throws IOException {
3636
super(in);
3737
}
3838

server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.elasticsearch.action.search.ShardSearchFailure;
2222
import org.elasticsearch.action.support.replication.ReplicationOperation;
2323
import org.elasticsearch.client.internal.AbstractClientHeadersTestCase;
24-
import org.elasticsearch.cluster.RemoteComputeException;
24+
import org.elasticsearch.cluster.RemoteException;
2525
import org.elasticsearch.cluster.action.shard.ShardStateAction;
2626
import org.elasticsearch.cluster.block.ClusterBlockException;
2727
import org.elasticsearch.cluster.coordination.CoordinationStateRejectedException;
@@ -841,7 +841,7 @@ public void testIds() {
841841
ids.put(181, ResourceAlreadyUploadedException.class);
842842
ids.put(182, IngestPipelineException.class);
843843
ids.put(183, IndexDocFailureStoreStatus.ExceptionWithFailureStoreStatus.class);
844-
ids.put(184, RemoteComputeException.class);
844+
ids.put(184, RemoteException.class);
845845

846846
Map<Class<? extends ElasticsearchException>, Integer> reverse = new HashMap<>();
847847
for (Map.Entry<Integer, Class<? extends ElasticsearchException>> entry : ids.entrySet()) {

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/EsqlTestUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.apache.lucene.sandbox.document.HalfFloatPoint;
1212
import org.apache.lucene.util.BytesRef;
1313
import org.elasticsearch.ExceptionsHelper;
14-
import org.elasticsearch.cluster.RemoteComputeException;
14+
import org.elasticsearch.cluster.RemoteException;
1515
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1616
import org.elasticsearch.cluster.service.ClusterService;
1717
import org.elasticsearch.common.Strings;
@@ -867,7 +867,7 @@ public static <T> T singleValue(Collection<T> collection) {
867867
* @return Cause of RemoteComputeException, else the error itself.
868868
*/
869869
public static Exception unwrapIfWrappedInRemoteComputeException(Exception e) {
870-
if (e instanceof RemoteComputeException rce) {
870+
if (e instanceof RemoteException rce) {
871871
return (Exception) rce.getCause();
872872
} else {
873873
return e;

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlRemoteErrorWrapIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
package org.elasticsearch.xpack.esql.action;
99

10-
import org.elasticsearch.cluster.RemoteComputeException;
10+
import org.elasticsearch.cluster.RemoteException;
1111
import org.elasticsearch.compute.operator.exchange.ExchangeService;
1212
import org.elasticsearch.test.transport.MockTransportService;
1313
import org.elasticsearch.transport.TransportService;
@@ -34,8 +34,8 @@ public void testThatRemoteErrorsAreWrapped() throws Exception {
3434
);
3535
}
3636

37-
RemoteComputeException wrappedError = expectThrows(
38-
RemoteComputeException.class,
37+
RemoteException wrappedError = expectThrows(
38+
RemoteException.class,
3939
() -> runQuery("FROM " + REMOTE_CLUSTER_1 + ":*," + REMOTE_CLUSTER_2 + ":* | LIMIT 100", false)
4040
);
4141
assertThat(wrappedError.getMessage(), is("Remote [cluster-a] encountered an error"));

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.elasticsearch.action.OriginalIndices;
1212
import org.elasticsearch.action.search.SearchRequest;
1313
import org.elasticsearch.action.search.ShardSearchFailure;
14-
import org.elasticsearch.cluster.RemoteComputeException;
14+
import org.elasticsearch.cluster.RemoteException;
1515
import org.elasticsearch.cluster.service.ClusterService;
1616
import org.elasticsearch.common.util.BigArrays;
1717
import org.elasticsearch.common.util.concurrent.RunOnce;
@@ -352,11 +352,9 @@ public void execute(
352352
* wrapped.
353353
*/
354354
if (ex instanceof TransportException te) {
355-
l.onFailure(
356-
new RemoteComputeException(cluster.clusterAlias(), FailureCollector.unwrapTransportException(te))
357-
);
355+
l.onFailure(new RemoteException(cluster.clusterAlias(), FailureCollector.unwrapTransportException(te)));
358356
} else {
359-
l.onFailure(new RemoteComputeException(cluster.clusterAlias(), ex));
357+
l.onFailure(new RemoteException(cluster.clusterAlias(), ex));
360358
}
361359
})
362360
);

0 commit comments

Comments
 (0)