aweisberg commented on code in PR #101:
URL: https://github.com/apache/cassandra-accord/pull/101#discussion_r1664571650
##########
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:
This isn't specifically for `withEpoch` it is for all the cases where the
callback has nothing to add other then the failure that happened impacted this
particular callback here.
The thing that sent me down his road was the pain point of burying the
actual exception type in the causal chain. I am trying to preserve actual root
cause type, so as not to break a lot of the existing code that just wants to
catch the root cause type.
If it's not already an Accord exception then there isn't much to add beyond,
yes this occurred at runtime. I think the biggest improvement here would be to
preserve a few more things like `Error`, `OutOfMemoryError`, and
`AssertionError`
--
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]