viktorsomogyi commented on a change in pull request #4090: URL: https://github.com/apache/kafka/pull/4090#discussion_r431001766
########## File path: core/src/main/scala/kafka/admin/ReassignPartitionsCommand.scala ########## @@ -1609,14 +1610,15 @@ object ReassignPartitionsCommand extends Logging { } def parsePartitionReassignmentData(jsonData: String): (Seq[(TopicPartition, Seq[Int])], Map[TopicPartitionReplica, String]) = { - Json.parseFull(jsonData) match { - case Some(js) => + Json.tryParseFull(jsonData) match { + case Right(js) => val version = js.asJsonObject.get("version") match { case Some(jsonValue) => jsonValue.to[Int] case None => EarliestVersion } parsePartitionReassignmentData(version, js) - case None => throw new AdminOperationException("The input string is not a valid JSON") + case Left(f) => + throw f Review comment: In this case I deliberately don't handle the exception in order to propagate it to the user who called this command. The purpose of this is to propagate the JSON parsing error so they know why (and where) was the JSON invalid. I can wrap this in an AdminOperationException but since it is intended for the user and not for catching, I think it can be left as it is. ---------------------------------------------------------------- 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