return response;
}
private void putLastError(Channel channel, MongoServerException ex) {
BSONObject error = new BasicBSONObject();
if (ex instanceof MongoServerError) {
MongoServerError err = (MongoServerError) ex;
error.put("err", err.getMessage());
error.put("code", Integer.valueOf(err.getCode()));
} else {
error.put("err", ex.getMessage());
}
// TODO: https://github.com/netty/netty/issues/1810
// also note:
// http://stackoverflow.com/questions/17690094/channel-id-has-been-removed-in-netty4-0-final-version-how-can-i-solve
error.put("connectionId", Integer.valueOf(channel.hashCode()));
putLastResult(channel, error);
}