vinothchandar commented on a change in pull request #8737: URL: https://github.com/apache/kafka/pull/8737#discussion_r432164756
########## File path: core/src/main/scala/kafka/admin/TopicCommand.scala ########## @@ -247,8 +247,12 @@ object TopicCommand extends Logging { val createResult = adminClient.createTopics(Collections.singleton(newTopic)) createResult.all().get() println(s"Created topic ${topic.name}.") - } else { - throw new IllegalArgumentException(s"Topic ${topic.name} already exists") + } catch { + case e : ExecutionException => + if (e.getCause == null) + throw e + if (!e.getCause.isInstanceOf[TopicExistsException] || !topic.ifTopicDoesntExist()) Review comment: yeah.. I can move the `!` outside so its easier to reason.. Personally, I do fine with both, but given we have two similar feedback now. Happy to change. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org