vinothchandar commented on a change in pull request #8737: URL: https://github.com/apache/kafka/pull/8737#discussion_r432171069
########## File path: core/src/main/scala/kafka/admin/TopicCommand.scala ########## @@ -259,7 +263,8 @@ object TopicCommand extends Logging { override def alterTopic(opts: TopicCommandOptions): Unit = { val topic = new CommandTopicPartition(opts) val topics = getTopics(opts.topic, opts.excludeInternalTopics) - ensureTopicExists(topics, opts.topic) + ensureTopicExists(topics, opts.topic, !opts.ifExists) Review comment: Okay.. so I did think about the case where `--if-exists` is provided and thus `ensureTopicExists()` will move on without erroring... But I chose to let whatever exception that is thrown like NoSuchTopicOrPartitionException to propagate back to the caller/main() method.. I guess you are suggesting to go to the server first and then handle the exception.. I am fine changing it, it does seem cleaner. ---------------------------------------------------------------- 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