AndrewJSchofield commented on code in PR #18587: URL: https://github.com/apache/kafka/pull/18587#discussion_r1920844889
########## clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java: ########## @@ -1134,6 +1129,13 @@ private ClusterAndWaitTime waitOnMetadata(String topic, Integer partition, long return new ClusterAndWaitTime(cluster, elapsed); } + private String getErrorMessage(Integer partitionsCount, String topic, Integer partition, long maxWaitMs) { + return partitionsCount == null ? + String.format("Topic %s not present in metadata after %d ms.", + topic, maxWaitMs) : + String.format("Partition %d of topic %s with partition count %d is not present in metadata after %d ms.", + partition, topic, partitionsCount, maxWaitMs); + } Review Comment: I think there are 3 cases too: 1. `partitionsCount == null` meaning we don't know how many partitions there are 2. `partitionsCount != null && partition == null` meaning we do know how many partitions there are but no partition was specified 3. `partitionsCount != null && partition != null` meaning we do know how many partitions there are and a partition was specified Seems to me that 3 messages would be best so that we never get a "null" as an ugly insert. wdyt? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org