kirktrue commented on code in PR #16686: URL: https://github.com/apache/kafka/pull/16686#discussion_r1775811800
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -1258,9 +1259,11 @@ private void close(Duration timeout, boolean swallowException) { AppInfoParser.unregisterAppInfo(CONSUMER_JMX_PREFIX, clientId, metrics); log.debug("Kafka consumer has been closed"); Throwable exception = firstException.get(); - if (exception != null && !swallowException) { + if ((wasInterrupted || exception != null) && !swallowException) { if (exception instanceof InterruptException) { throw (InterruptException) exception; + } else if (wasInterrupted) { + throw new InterruptException("Consumer was interrupted by user prior to close()"); Review Comment: The `String`-argument constructor for `InterruptedException` creates an `InterruptException` to use as the cause. But you're right that the error message is different. I will remove the custom message to make it more like the `ClassicKafkaConsumer`. -- 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