public static Map<TopicPartition, Errors> errorsForTransaction(AddPartitionsToTxnTopicResultCollection topicCollection) {
        Map<TopicPartition, Errors> topicResults = new HashMap<>();
        for (AddPartitionsToTxnTopicResult topicResult : topicCollection) {
            for (AddPartitionsToTxnPartitionResult partitionResult : topicResult.resultsByPartition()) {
                topicResults.put(
                    new TopicPartition(topicResult.name(), partitionResult.partitionIndex()), Errors.forCode(partitionResult.partitionErrorCode()));
            }
        }
        return topicResults;
    }
Possible error codes:

  - {@link Errors#NOT_COORDINATOR}
  - {@link Errors#COORDINATOR_NOT_AVAILABLE}
  - {@link Errors#COORDINATOR_LOAD_IN_PROGRESS}
  - {@link Errors#INVALID_TXN_STATE}
  - {@link Errors#INVALID_PRODUCER_ID_MAPPING}
  - {@link Errors#INVALID_PRODUCER_EPOCH} // for version <=1
  - {@link Errors#PRODUCER_FENCED}
  - {@link Errors#TOPIC_AUTHORIZATION_FAILED}
  - {@link Errors#TRANSACTIONAL_ID_AUTHORIZATION_FAILED}
  - {@link Errors#UNKNOWN_TOPIC_OR_PARTITION}
clients/src/main/java/org/apache/kafka/common/requests/AddPartitionsToTxnResponse.java