Mention the HttpObjectEncoder's state in the message of the IllegalStateException (#7996)

Motivation

The HttpObjectEncoder raises an IllegalStateException due to an illegal state but doesn't mention what the state was. It could be useful for debugging purposes to figure out what happened.

Modifications

Mention the HttpObjectEncoder's state in the message of the IllegalStateException.

Result

An exception with more information what caused it.
This commit is contained in:
Roger 2018-06-04 04:14:58 -04:00 committed by Norman Maurer
parent 1611acf4ce
commit 6208c9b0d6

View File

@ -83,7 +83,8 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
ByteBuf buf = null;
if (msg instanceof HttpMessage) {
if (state != ST_INIT) {
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg)
+ ", state: " + state);
}
@SuppressWarnings({ "unchecked", "CastConflictsWithInstanceof" })