mjsax commented on code in PR #16344:
URL: https://github.com/apache/kafka/pull/16344#discussion_r1640177695
##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1176,18 +1178,25 @@ private ClusterAndWaitTime waitOnMetadata(String topic,
Integer partition, long
metadata.awaitUpdate(version, remainingWaitMs);
} catch (TimeoutException ex) {
// Rethrow with original maxWaitMs to prevent logging
exception with remainingWaitMs
- throw new TimeoutException(
- String.format("Topic %s not present in metadata after
%d ms.",
- topic, maxWaitMs));
+ final String errorMessage = String.format("Topic %s not
present in metadata after %d ms.",
+ topic, maxWaitMs);
+ if (metadata.getError(topic) ==
Errors.UNKNOWN_TOPIC_OR_PARTITION) {
+ throw new UnknownTopicOrPartitionException(errorMessage);
Review Comment:
I think we don't want to throw this exception directly, but rather still
throw `TimeoutException` but with a nested `UnknownTopicOrPartitionException`
(ie, as "cause" of the timeout)?
--
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]