You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/04/14 13:36:40 UTC

[GitHub] [kafka] ijuma commented on a diff in pull request #7283: KAFKA-8862: Use consistent exception messages for nonexistent partition

ijuma commented on code in PR #7283:
URL: https://github.com/apache/kafka/pull/7283#discussion_r850452641


##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1053,6 +1048,14 @@ private ClusterAndWaitTime waitOnMetadata(String topic, Integer partition, long
         return new ClusterAndWaitTime(cluster, elapsed);
     }
 
+    private TimeoutException timeoutForAbsentMetadata(String topic, Integer partition, long maxWaitMs, Integer partitionsCount) {
+        return new TimeoutException(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:
   Should we set a cause to the `TimeoutException` to make it easy to programmatically handle the case where the topic or partition doesn't exist (vs all other reasons why `TimeoutException` may be thrown).



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org