nodece commented on a change in pull request #14087:
URL: https://github.com/apache/pulsar/pull/14087#discussion_r800332200



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
##########
@@ -1166,7 +1166,7 @@ public void validateTopicOperation(TopicName topicName, 
TopicOperation operation
         }
     }
 
-    protected Void handleCommonRestAsyncException(AsyncResponse asyncResponse, 
Throwable ex) {
+    protected static Void handleCommonRestAsyncException(AsyncResponse 
asyncResponse, Throwable ex) {

Review comment:
       You can improve `AdminResource#resumeAsyncResponseExceptionally()` and 
move to `PulsarWebResource`, so like:
   ```java
       protected static void resumeAsyncResponseExceptionally(AsyncResponse 
asyncResponse, Throwable throwable) {
           throwable = FutureUtil.unwrapCompletionException(throwable);
           if (throwable instanceof WebApplicationException) {
               asyncResponse.resume(throwable);
           } else if (throwable instanceof 
BrokerServiceException.NotAllowedException) {
               asyncResponse.resume(new RestException(Status.CONFLICT, 
throwable));
           } else {
               asyncResponse.resume(new RestException(throwable));
           }
       }
   ```
   
   We shouldn't have two similar methods, it makes confusion.
   




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to