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



##########
File path: 
pulsar-common/src/main/java/org/apache/pulsar/common/util/FutureUtil.java
##########
@@ -174,6 +166,16 @@ public synchronized Throwable fillInStackTrace() {
         }
     }
 
+    public static Throwable unwrapCompletionException(Throwable ex) {
+        if (ex instanceof CompletionException) {
+            return ex.getCause();
+        } else if (ex instanceof ExecutionException) {
+            return ex.getCause();

Review comment:
       Because the source code of ``CompletableFuture``
   
   
https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java#L323-L348
   
   The ``CompletionException`` won't be wrapped twice. 




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