Skip to content

Commit 0f8044c

Browse files
Handled the exception to respond with a Future.fail
1 parent ed67b4d commit 0f8044c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/main/java/io/vertx/kafka/client/consumer/impl/KafkaConsumerImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,14 @@ public KafkaConsumer<K, V> partitionsFor(String topic, Handler<AsyncResult<List<
389389
if (done.succeeded()) {
390390
// TODO: use Helper class and stream approach
391391
List<PartitionInfo> partitions = new ArrayList<>();
392-
for (org.apache.kafka.common.PartitionInfo kafkaPartitionInfo: done.result()) {
392+
List<org.apache.kafka.common.PartitionInfo> partitionInfos;
393+
try {
394+
partitionInfos = done.result();
395+
} catch (Exception e) {
396+
handler.handle(Future.failedFuture(e));
397+
return;
398+
}
399+
for (org.apache.kafka.common.PartitionInfo kafkaPartitionInfo: partitionInfos) {
393400

394401
PartitionInfo partitionInfo = new PartitionInfo();
395402

0 commit comments

Comments
 (0)