Skip to content

Commit

Permalink
[Rename] ElasticsearchWrapperException class in server module (#174)
Browse files Browse the repository at this point in the history
This commit refactors the ElasticsearchWrapperException class in the server
module to OpenSearchWrapperException. References and usages throughout the rest
of the codebase are fully refactored.

Signed-off-by: Nicholas Knize <[email protected]>
  • Loading branch information
nknize committed Mar 22, 2021
1 parent e60906f commit c42c210
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static RestStatus status(Throwable t) {
public static Throwable unwrapCause(Throwable t) {
int counter = 0;
Throwable result = t;
while (result instanceof ElasticsearchWrapperException) {
while (result instanceof OpenSearchWrapperException) {
if (result.getCause() == null) {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public RestStatus status() {

/**
* Unwraps the actual cause from the exception for cases when the exception is a
* {@link ElasticsearchWrapperException}.
* {@link OpenSearchWrapperException}.
*
* @see ExceptionsHelper#unwrapCause(Throwable)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
* as an error because its is {@link #getCause() cause}, if non-null is
* <strong>always</strong> more useful to the user than the exception itself.
*/
public interface ElasticsearchWrapperException {
public interface OpenSearchWrapperException {
Throwable getCause();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.action.support.broadcast;

import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.index.shard.ShardId;

Expand All @@ -31,7 +31,7 @@
*
*
*/
public class BroadcastShardOperationFailedException extends OpenSearchException implements ElasticsearchWrapperException {
public class BroadcastShardOperationFailedException extends OpenSearchException implements OpenSearchWrapperException {

public BroadcastShardOperationFailedException(ShardId shardId, String msg) {
this(shardId, msg, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
package org.elasticsearch.indices;

import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;

import java.io.IOException;

public class IndexCreationException extends OpenSearchException implements ElasticsearchWrapperException {
public class IndexCreationException extends OpenSearchException implements OpenSearchWrapperException {

public IndexCreationException(String index, Throwable cause) {
super("failed to create index [{}]", cause, index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package org.elasticsearch.indices.recovery;

import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.ByteSizeValue;
Expand All @@ -29,7 +29,7 @@
import java.io.IOException;
import java.util.Objects;

public class RecoverFilesRecoveryException extends OpenSearchException implements ElasticsearchWrapperException {
public class RecoverFilesRecoveryException extends OpenSearchException implements OpenSearchWrapperException {

private final int numberOfFiles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
package org.elasticsearch.ingest;

import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;

import java.io.IOException;

/**
* A dedicated wrapper for exceptions encountered executing an ingest processor. The wrapper is needed as we currently only unwrap causes
* for instances of {@link ElasticsearchWrapperException}.
* for instances of {@link OpenSearchWrapperException}.
*/
public class IngestProcessorException extends OpenSearchException implements ElasticsearchWrapperException {
public class IngestProcessorException extends OpenSearchException implements OpenSearchWrapperException {

IngestProcessorException(final Exception cause) {
super(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
package org.elasticsearch.search;

import org.elasticsearch.OpenSearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;

import java.io.IOException;

public class SearchException extends OpenSearchException implements ElasticsearchWrapperException {
public class SearchException extends OpenSearchException implements OpenSearchWrapperException {

private final SearchShardTarget shardTarget;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.elasticsearch.transport;

import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.transport.TransportAddress;

Expand All @@ -31,7 +31,7 @@
*
*
*/
public class RemoteTransportException extends ActionTransportException implements ElasticsearchWrapperException {
public class RemoteTransportException extends ActionTransportException implements OpenSearchWrapperException {

public RemoteTransportException(String msg, Throwable cause) {
super(msg, null, null, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

package org.elasticsearch.transport;

import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.OpenSearchWrapperException;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.StreamInput;

import java.io.IOException;

public class SendRequestTransportException extends ActionTransportException implements ElasticsearchWrapperException {
public class SendRequestTransportException extends ActionTransportException implements OpenSearchWrapperException {

public SendRequestTransportException(DiscoveryNode node, String action, Throwable cause) {
super(node == null ? null : node.getName(), node == null ? null : node.getAddress(), action, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,24 +237,24 @@ public void testErrorToAndFromXContent() throws IOException {
case 3:
TransportAddress address = buildNewFakeTransportAddress();
original = new RemoteTransportException("remote", address, "action",
new ResourceAlreadyExistsException("ElasticsearchWrapperException with a cause that has a custom status"));
new ResourceAlreadyExistsException("OpenSearchWrapperException with a cause that has a custom status"));
status = RestStatus.BAD_REQUEST;
if (detailed) {
type = "resource_already_exists_exception";
reason = "ElasticsearchWrapperException with a cause that has a custom status";
reason = "OpenSearchWrapperException with a cause that has a custom status";
} else {
reason = "RemoteTransportException[[remote][" + address.toString() + "][action]]";
}
break;
case 4:
original = new RemoteTransportException("ElasticsearchWrapperException with a cause that has a special treatment",
original = new RemoteTransportException("OpenSearchWrapperException with a cause that has a special treatment",
new IllegalArgumentException("wrong"));
status = RestStatus.BAD_REQUEST;
if (detailed) {
type = "illegal_argument_exception";
reason = "wrong";
} else {
reason = "RemoteTransportException[[ElasticsearchWrapperException with a cause that has a special treatment]]";
reason = "RemoteTransportException[[OpenSearchWrapperException with a cause that has a special treatment]]";
}
break;
case 5:
Expand Down

0 comments on commit c42c210

Please sign in to comment.