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



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/UpdateFeaturesRequest.java
##########
@@ -57,18 +55,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,

Review comment:
       You could inline `ApiError.fromThrowable(e)` here, and eliminate the 
`apiError` local variable.




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