dcapwell commented on code in PR #101:
URL: https://github.com/apache/cassandra-accord/pull/101#discussion_r1664558523


##########
accord-core/src/main/java/accord/coordinate/CoordinationFailed.java:
##########
@@ -61,4 +70,21 @@ void set(TxnId txnId, RoutingKey homeKey)
     {
         return homeKey;
     }
+
+    /**
+     * Wrap the exception without changing the type so asynchronous callbacks 
can add their own stack
+     */
+    public CoordinationFailed wrap()
+    {
+        checkState(this.getClass() == CoordinationFailed.class);
+        return new CoordinationFailed(txnId, homeKey, this);
+    }
+
+    public static Throwable wrap(Throwable t)
+    {
+        if (t instanceof CoordinationFailed)
+            return ((CoordinationFailed)t).wrap();
+        else
+            throw new RuntimeException(t);

Review Comment:
   not a fan of this case... `CoordinationFailed` has nothing to do in this 
case... Why not do something like `EpochException` where the `cause` is the 
reason?  Most of the callers are just wrapping the epoch fail cause... so why 
not make that type more clear?



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