yifan-c commented on code in PR #61:
URL: https://github.com/apache/cassandra-sidecar/pull/61#discussion_r1262840617


##########
client/src/main/java/org/apache/cassandra/sidecar/client/exception/RetriesExhaustedException.java:
##########
@@ -28,24 +29,52 @@ public class RetriesExhaustedException extends 
RuntimeException
     /**
      * Constructs an exception with the number of {@code attempts} performed 
for the request.
      *
-     * @param attempts the number of attempts performed for the request
-     * @param request  the HTTP request
+     * @param attempts      the number of attempts performed for the request
+     * @param request       the HTTP request
+     * @param lastResponse  the last failed HTTP response
      */
-    public RetriesExhaustedException(int attempts, Request request)
+    public static RetriesExhaustedException of(int attempts,
+                                               Request request,
+                                               HttpResponse lastResponse)
     {
-        this(attempts, request, null);
+        return of(attempts, request, lastResponse, null);
     }
 
     /**
      * Constructs an exception with the number of {@code attempts} performed 
for the request.
      *
-     * @param attempts  the number of attempts performed for the request
-     * @param request   the HTTP request
-     * @param throwable the underlying exception
+     * @param attempts      the number of attempts performed for the request
+     * @param request       the HTTP request
+     * @param lastResponse  the last failed HTTP response
+     * @param throwable     the underlying exception
      */
-    public RetriesExhaustedException(int attempts, Request request, Throwable 
throwable)
+    public static RetriesExhaustedException of(int attempts,
+                                               Request request,
+                                               HttpResponse lastResponse,
+                                               Throwable throwable)
     {
-        super(String.format("Unable to complete request '%s' after %d 
attempt%s",
-                            request.requestURI(), attempts, attempts == 1 ? "" 
: "s"), throwable);
+        return new RetriesExhaustedException(attempts, request, lastResponse, 
throwable);
+    }
+
+    /**
+     * Constructs an exception with the number of {@code attempts} performed 
for the request.
+     *
+     * @param attempts      the number of attempts performed for the request
+     * @param request       the HTTP request
+     * @param lastResponse  the last failed HTTP response
+     * @param throwable     the underlying exception
+     */
+    protected RetriesExhaustedException(int attempts,

Review Comment:
   review note: There is no need to create multiple constructor overloads.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to