chia7712 commented on a change in pull request #9781:
URL: https://github.com/apache/kafka/pull/9781#discussion_r547605207



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/UpdateFeaturesRequest.java
##########
@@ -56,19 +54,11 @@ public UpdateFeaturesRequest(UpdateFeaturesRequestData 
data, short version) {
 
     @Override
     public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) {
-        final ApiError apiError = ApiError.fromThrowable(e);
-        final UpdatableFeatureResultCollection results = new 
UpdatableFeatureResultCollection();
-        for (FeatureUpdateKey update : this.data.featureUpdates().valuesSet()) 
{
-            final UpdatableFeatureResult result = new UpdatableFeatureResult()
-                .setFeature(update.feature())
-                .setErrorCode(apiError.error().code())
-                .setErrorMessage(apiError.message());
-            results.add(result);
-        }
-        final UpdateFeaturesResponseData responseData = new 
UpdateFeaturesResponseData()
-            .setThrottleTimeMs(throttleTimeMs)
-            .setResults(results);
-        return new UpdateFeaturesResponse(responseData);
+        return UpdateFeaturesResponse.createWithErrors(
+            ApiError.fromThrowable(e),
+            Collections.emptyMap(),

Review comment:
       If we want set only top-level error, we have to make 
```UpdateFeaturesResponse#errors``` use top-level error as well. Otherwise, the 
top-level error can't be propagated correctly. 
   
   
   see 
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/UpdateFeaturesResponse.java#L48




----------------------------------------------------------------
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:
[email protected]


Reply via email to