public RuntimeException error(int batchIndex) {
        if (errorsByIndex == null) {
            return null;
        } else {
            return errorsByIndex.apply(batchIndex);
        }
    }
The error thrown (generally on the server) while processing this request
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProduceRequestResult.java