@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { if (e.getCause() instanceof JsonParseException) { BaseTransport.respond( e.getChannel(), HttpResponseStatus.INTERNAL_SERVER_ERROR, "Broken JSON encoding."); } else if (e.getCause() instanceof SessionHandler.NotFoundException) { BaseTransport.respond( e.getChannel(), HttpResponseStatus.NOT_FOUND, "Session not found. Cannot send data to non-existing session."); } else { super.exceptionCaught(ctx, e); } }