diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionNotFoundTransportException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionNotFoundTransportException.java index bb045b3a96c..a4c2fa0c2f4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionNotFoundTransportException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/ActionNotFoundTransportException.java @@ -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; } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java index d1910bd8c6d..3cc3f080f8e 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/transport/netty/MessageChannelHandler.java @@ -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);