dongnuo123 commented on code in PR #14408: URL: https://github.com/apache/kafka/pull/14408#discussion_r1344523685
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java: ########## @@ -259,30 +262,11 @@ public CompletableFuture<ConsumerGroupHeartbeatResponseData> consumerGroupHeartb "consumer-group-heartbeat", topicPartitionFor(request.groupId()), coordinator -> coordinator.consumerGroupHeartbeat(context, request) - ).exceptionally(exception -> { - if (exception instanceof UnknownTopicOrPartitionException || - exception instanceof NotEnoughReplicasException) { - return new ConsumerGroupHeartbeatResponseData() - .setErrorCode(Errors.COORDINATOR_NOT_AVAILABLE.code()); - } - - if (exception instanceof NotLeaderOrFollowerException || - exception instanceof KafkaStorageException) { - return new ConsumerGroupHeartbeatResponseData() - .setErrorCode(Errors.NOT_COORDINATOR.code()); - } - - if (exception instanceof RecordTooLargeException || - exception instanceof RecordBatchTooLargeException || - exception instanceof InvalidFetchSizeException) { - return new ConsumerGroupHeartbeatResponseData() - .setErrorCode(Errors.UNKNOWN_SERVER_ERROR.code()); - } - - return new ConsumerGroupHeartbeatResponseData() - .setErrorCode(Errors.forException(exception).code()) - .setErrorMessage(exception.getMessage()); - }); + ).exceptionally(exception -> + new ConsumerGroupHeartbeatResponseData() + .setErrorCode(getErrorsForException(exception).code()) Review Comment: rolled back -- 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