Copilot commented on code in PR #19981: URL: https://github.com/apache/kafka/pull/19981#discussion_r2152531189
########## core/src/test/scala/integration/kafka/api/AuthorizerIntegrationTest.scala: ########## @@ -225,7 +227,9 @@ class AuthorizerIntegrationTest extends AbstractAuthorizerIntegrationTest { resp.data.errorCode)), ApiKeys.ALTER_SHARE_GROUP_OFFSETS -> ((resp: AlterShareGroupOffsetsResponse) => Errors.forCode( resp.data.errorCode)), - ApiKeys.STREAMS_GROUP_HEARTBEAT -> ((resp: StreamsGroupHeartbeatResponse) => Errors.forCode(resp.data.errorCode)) + ApiKeys.STREAMS_GROUP_HEARTBEAT -> ((resp: StreamsGroupHeartbeatResponse) => Errors.forCode(resp.data.errorCode)), + ApiKeys.STREAMS_GROUP_DESCRIBE -> ((resp: StreamsGroupDescribeResponse) => + Errors.forCode(resp.data.groups.asScala.find(g => streamsGroup == g.groupId).head.errorCode)) Review Comment: Using .head on the option returned by find could result in a NoSuchElementException if no matching group is found. Consider handling the case using getOrElse or pattern matching to provide a clearer error or fallback value. ```suggestion Errors.forCode(resp.data.groups.asScala.find(g => streamsGroup == g.groupId) .getOrElse(throw new NoSuchElementException(s"No group found with groupId: $streamsGroup")).errorCode)) ``` -- 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