AndrewJSchofield commented on code in PR #19372:
URL: https://github.com/apache/kafka/pull/19372#discussion_r2030206882


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -2284,22 +2273,15 @@ CompletableFuture<Void> 
writeShareGroupState(List<PersisterStateBatch> stateBatc
 
     private KafkaException fetchPersisterError(short errorCode, String 
errorMessage) {
         Errors error = Errors.forCode(errorCode);
-        switch (error) {
-            case NOT_COORDINATOR:
-            case COORDINATOR_NOT_AVAILABLE:
-            case COORDINATOR_LOAD_IN_PROGRESS:
-                return new CoordinatorNotAvailableException(errorMessage);
-            case GROUP_ID_NOT_FOUND:
-                return new GroupIdNotFoundException(errorMessage);
-            case UNKNOWN_TOPIC_OR_PARTITION:
-                return new UnknownTopicOrPartitionException(errorMessage);
-            case FENCED_STATE_EPOCH:
-                return new FencedStateEpochException(errorMessage);
-            case FENCED_LEADER_EPOCH:
-                return new NotLeaderOrFollowerException(errorMessage);
-            default:
-                return new UnknownServerException(errorMessage);
-        }
+        return switch (error) {
+            case NOT_COORDINATOR, COORDINATOR_NOT_AVAILABLE, 
COORDINATOR_LOAD_IN_PROGRESS ->
+                new CoordinatorNotAvailableException(errorMessage);
+            case GROUP_ID_NOT_FOUND -> new 
GroupIdNotFoundException(errorMessage);

Review Comment:
   I'd say that this looks a little scruffy compared with the previous version. 
How about aligning all of the `new` statements to match line 2278? Uses more 
lines but tidier I feel.



-- 
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

Reply via email to