ivankelly commented on a change in pull request #11627:
URL: https://github.com/apache/pulsar/pull/11627#discussion_r688335842



##########
File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java
##########
@@ -83,6 +86,49 @@ public PulsarClientException(String msg, Throwable t) {
         super(msg, t);
     }
 
+    /**
+     * Add a list of previous exception which occurred for the same operation
+     * and have been retried.
+     *
+     * @param previous A collection of throwables that triggered retries
+     */
+    public void setPreviousExceptions(Collection<Throwable> previous) {
+        this.previous = previous;
+    }
+
+    /**
+     * Get the collection of previous exceptions which have caused retries
+     * for this operation.
+     *
+     * @return a collection of exception, ordered as they occurred
+     */
+    public Collection<Throwable> getPreviousExceptions() {
+        return this.previous;
+    }
+
+    @Override
+    public String toString() {

Review comment:
       What I meant is, we don't print the exception with the previous 
exceptions attached every time we log. We only print that when at the point 
that we're about to complete the subscribeFuture or producerCreatedFuture with 
an exception. Which is when the exception gets passed to the client. For me, 
the logging of that exception is incidental. What I want is for the client code 
to get an exception that has context about the retries. 
   
   Take for example the case of a customer who has a flink pipeline, and they 
get a TooManyRequestsException. They take a screenshot of the exception in the 
flink dashboard and send it to us. I want all the information to be in that 
screenshot, and not have to ask them to dig around in flink logs to get it.




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