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



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
##########
@@ -755,14 +755,16 @@ protected void 
internalCreatePartitionedTopic(AsyncResponse asyncResponse, int n
         return future;
     }
 
-    protected void resumeAsyncResponseExceptionally(AsyncResponse 
asyncResponse, Throwable throwable) {
-        if (throwable instanceof WebApplicationException) {
-            asyncResponse.resume(throwable);
-        } else if (throwable instanceof 
BrokerServiceException.NotAllowedException) {
-            asyncResponse.resume(new RestException(Status.CONFLICT, 
throwable));
+    protected static Void resumeAsyncResponseExceptionally(AsyncResponse 
asyncResponse, Throwable exception) {

Review comment:
       Could we use it in ``exceptionally`` to avoid unnecessary ``return 
null``?
   
   Use ``Avoid`` return type
   ```java
   //....
   .exceptionally(ex -> {
        return handleCommonRestAsyncException(asyncResponse, ex);
   })
   ```
   Don't use ``Avoid`` return type
   ```java
   //....
   .exceptionally(ex -> {
        handleCommonRestAsyncException(asyncResponse, ex);
        return null;
   })
   ```
   




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