frankvicky commented on code in PR #20159: URL: https://github.com/apache/kafka/pull/20159#discussion_r2207421644
########## clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java: ########## @@ -1225,7 +1230,9 @@ private ClusterAndWaitTime waitOnMetadata(String topic, Integer partition, long if (metadata.getError(topic) != null) { throw new TimeoutException(errorMessage, metadata.getError(topic).exception()); } - throw new TimeoutException(errorMessage); + if (ex.getCause() != null) + throw new TimeoutException(errorMessage, ex.getCause()); + throw new TimeoutException(errorMessage, new PotentialCauseException("Metadata update timed out ― topic missing, auth denied, broker/partition unavailable, or client sender/buffer stalled.")); Review Comment: The proposal of reusing `KafkaException` sounds good. +1 to it. -- 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