You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2020/07/29 09:18:41 UTC

[pulsar] 15/20: Add more detail information of retry errors (#7341)

This is an automated email from the ASF dual-hosted git repository.

rxl pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit a050d7809ed104e55cd472725a7b5f6601521678
Author: Yong Zhang <zh...@gmail.com>
AuthorDate: Mon Jul 6 15:36:02 2020 +0800

    Add more detail information of retry errors (#7341)
    
    ---
    
    *Motivation*
    
    Currently, when you connecting to a wrong address, the error
    log does not show the detail information to let you know why
    it failed. Add the failed reason to know more about the error.
    
    Before adding the error log:
    
    ```
    bin/pulsar-admin topics list public/default
    null
    
    Reason: java.util.concurrent.CompletionException: org.apache.pulsar.client.admin.internal.http.AsyncHttpConnector$RetryException: Could not complete the operation. Number of retries has been exhausted.
    ```
    
    After adding the error log:
    
    ```
    bin/pulsar-admin topics list public/default
    null
    
    Reason: java.util.concurrent.CompletionException: org.apache.pulsar.client.admin.internal.http.AsyncHttpConnector$RetryException: Could not complete the operation. Number of retries has been exhausted.Connection refused: localhost/127.0.0.1:8081
    ```
    
    (cherry picked from commit f4547ecfe37c6752251699aadf8c19b380f42bc9)
---
 .../apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
index eca1800..c0dc467 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
@@ -240,8 +240,9 @@ public class AsyncHttpConnector implements Connector {
                                             retries - 1);
                                 } else {
                                     resultFuture.completeExceptionally(
-                                            new RetryException("Could not complete the operation. Number of retries "
-                                            + "has been exhausted.", throwable));
+                                        new RetryException("Could not complete the operation. Number of retries "
+                                            + "has been exhausted. Failed reason: " + throwable.getMessage(),
+                                            throwable));
                                 }
                             }
                         } else {