better exception thrown when failing to handle responses
This commit is contained in:
parent
e85c47db74
commit
a10ab7fe08
|
@ -24,7 +24,9 @@ import java.util.Comparator;
|
|||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* A {@link TreeSet} that is bounded by size.
|
||||
*
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class BoundedTreeSet<E> extends TreeSet<E> {
|
||||
|
||||
|
|
|
@ -20,15 +20,11 @@
|
|||
package org.elasticsearch.transport;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class ResponseHandlerFailureTransportException extends TransportException {
|
||||
public class ResponseHandlerFailureTransportException extends RemoteTransportException {
|
||||
|
||||
public ResponseHandlerFailureTransportException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public ResponseHandlerFailureTransportException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
public ResponseHandlerFailureTransportException(Throwable cause) {
|
||||
super(cause.getMessage(), cause);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.transport;
|
|||
import org.elasticsearch.ElasticSearchException;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class TransportException extends ElasticSearchException {
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ public class LocalTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
try {
|
||||
handler.handleResponse(streamable);
|
||||
} catch (Exception e) {
|
||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
||||
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -246,7 +246,7 @@ public class LocalTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
//noinspection unchecked
|
||||
handler.handleResponse(streamable);
|
||||
} catch (Exception e) {
|
||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
||||
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
|||
try {
|
||||
handler.handleResponse(streamable);
|
||||
} catch (Exception e) {
|
||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
||||
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
|||
handler.handleResponse(streamable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleException(handler, new ResponseHandlerFailureTransportException("Failed to handle response", e));
|
||||
handleException(handler, new ResponseHandlerFailureTransportException(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
|||
|
||||
private void handleException(final TransportResponseHandler handler, Throwable error) {
|
||||
if (!(error instanceof RemoteTransportException)) {
|
||||
error = new RemoteTransportException("None remote transport exception", error);
|
||||
error = new RemoteTransportException(error.getMessage(), error);
|
||||
}
|
||||
final RemoteTransportException rtx = (RemoteTransportException) error;
|
||||
if (handler.spawn()) {
|
||||
|
|
Loading…
Reference in New Issue