better exception thrown when failing to handle responses

This commit is contained in:
kimchy 2010-08-27 14:14:28 +03:00
parent e85c47db74
commit a10ab7fe08
5 changed files with 13 additions and 15 deletions

View File

@ -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> {

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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));
}
}
}

View File

@ -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()) {