+ // Propagate the original exception
+ final Exception e;
+ if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) {
+ e = new DataStoreUnavailableException(throwable.getMessage(), throwable);
+ } else if (throwable instanceof Exception) {
+ e = (Exception)throwable;
+ } else {
+ e = new RuntimeException("Unexpected error occurred", throwable);
+ }
+ clientSubmitFuture.setException(exMapper.apply(e));
+