Skip to content
Permalink
Browse files
Enrich error message on request exceptions (#7)
  • Loading branch information
yifan-c committed Apr 14, 2020
1 parent 8090d55 commit c8670b0fdcfebd0edbf9e43ef3cc6d46cde36b0f
Showing 1 changed file with 14 additions and 5 deletions.
@@ -86,8 +86,10 @@ public Iterator<PartitionKey> getPartitionKeys(String table, final BigInteger pr
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 @@ protected PartitionKey computeNext() {
}

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

0 comments on commit c8670b0

Please sign in to comment.