Enrich error message on request exceptions (#7)
diff --git a/spark-job/src/main/java/org/apache/cassandra/diff/DiffCluster.java b/spark-job/src/main/java/org/apache/cassandra/diff/DiffCluster.java
index 4e108e3..4bbd81c 100644
--- a/spark-job/src/main/java/org/apache/cassandra/diff/DiffCluster.java
+++ b/spark-job/src/main/java/org/apache/cassandra/diff/DiffCluster.java
@@ -86,8 +86,10 @@
try {
return Uninterruptibles.getUninterruptibly(fetchPartitionKeys(table, prevToken, token));
}
- catch (ExecutionException e) {
- throw new RuntimeException(e);
+ catch (ExecutionException ex) {
+ throw new RuntimeException(String.format("Unable to get partition keys (%s, %s] in table (%s) from cluster (%s)",
+ prevToken, token, table, clusterId.name()),
+ ex);
}
}
@@ -118,9 +120,16 @@
}
public Iterator<Row> getPartition(TableSpec table, PartitionKey key, boolean shouldReverse) {
- return readPartition(table.getTable(), key, shouldReverse)
- .getUninterruptibly()
- .iterator();
+ try {
+ return readPartition(table.getTable(), key, shouldReverse)
+ .getUninterruptibly()
+ .iterator();
+ }
+ catch (Exception ex) {
+ throw new RuntimeException(String.format("Unable to get partition (%s) in table (%s) from cluster (%s)",
+ key.getTokenAsBigInteger(), table, clusterId.name()),
+ ex);
+ }
}
private ResultSetFuture readPartition(String table, final PartitionKey key, boolean shouldReverse) {