chia7712 commented on code in PR #20159:
URL: https://github.com/apache/kafka/pull/20159#discussion_r2537599894


##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1237,7 +1259,11 @@ private ClusterAndWaitTime waitOnMetadata(String topic, 
Integer partition, long
                 if (metadata.getError(topic) != null && 
metadata.getError(topic).exception() instanceof RetriableException) {
                     throw new TimeoutException(errorMessage, 
metadata.getError(topic).exception());
                 }
-                throw new TimeoutException(errorMessage);
+                if (metadata.getError(topic) != null) {

Review Comment:
   After reading the discussion at 
https://github.com/apache/kafka/pull/16344#discussion_r1646385464, I note that 
adding `KafkaException` creates a strange scenario where a retriable exception 
has a non-retriable error as its root cause. This could confuse users when 
handling the exception. Did we discuss simply enriching the exception message 
directly instead?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to