added bodyconsumer non-null check in sendError