showuon commented on a change in pull request #10794: URL: https://github.com/apache/kafka/pull/10794#discussion_r666750287
########## File path: clients/src/main/java/org/apache/kafka/common/requests/ApiError.java ########## @@ -36,10 +38,21 @@ private final String message; public static ApiError fromThrowable(Throwable t) { + Throwable throwableToBeEncode = t; Review comment: Updated. ########## File path: core/src/main/scala/kafka/network/RequestChannel.scala ########## @@ -124,8 +124,15 @@ object RequestChannel extends Logging { def buildResponseSend(abstractResponse: AbstractResponse): Send = { envelope match { case Some(request) => - val responseBytes = context.buildResponseEnvelopePayload(abstractResponse) - val envelopeResponse = new EnvelopeResponse(responseBytes, Errors.NONE) + val envelopeResponse = if (abstractResponse.errorCounts().containsKey(Errors.NOT_CONTROLLER)) { + // Since it's a Not Controller error response, we need to make envelope response with Not Controller error Review comment: Added -- 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