Prettify primary response in assertion message
We are getting the default Object#toString implementation here, we need
more than this. This commit instead formats the primary response to JSON
so we can see into its soul.
package org.elasticsearch.action.bulk;
import org.elasticsearch.action.DocWriteRequest;
+import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
@@ -78,7 +79,7 @@ public class BulkItemRequest implements Streamable {
setPrimaryResponse(new BulkItemResponse(id, request.opType(), failure));
} else {
assert primaryResponse.isFailed() && primaryResponse.getFailure().isAborted()
- : "response [" + primaryResponse + "]; cause [" + cause + "]";
+ : "response [" + Strings.toString(primaryResponse) + "]; cause [" + cause + "]";
if (primaryResponse.isFailed() && primaryResponse.getFailure().isAborted()) {
primaryResponse.getFailure().getCause().addSuppressed(cause);
} else {
