throw an exception when an action is not found
This commit is contained in:
parent
32e4c405de
commit
9a49629d17
|
@ -20,11 +20,20 @@
|
|||
package org.elasticsearch.transport;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* An exception indicating that a transport action was not found.
|
||||
*
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class ActionNotFoundTransportException extends TransportException {
|
||||
|
||||
public ActionNotFoundTransportException(String message) {
|
||||
super(message);
|
||||
private final String action;
|
||||
|
||||
public ActionNotFoundTransportException(String action) {
|
||||
super("No handler for action [" + action + "]");
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String action() {
|
||||
return this.action;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
|||
try {
|
||||
final TransportRequestHandler handler = transportServiceAdapter.handler(action);
|
||||
if (handler == null) {
|
||||
logger.warn("No handler found for action [{}]", action);
|
||||
throw new ActionNotFoundTransportException(action);
|
||||
}
|
||||
final Streamable streamable = handler.newInstance();
|
||||
streamable.readFrom(buffer);
|
||||
|
|
Loading…
Reference in New Issue