Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Fix CompletionException wrapped exception (#817)
Browse files Browse the repository at this point in the history
metadataStore will wrap the actual exception in CompletionException.
  • Loading branch information
wenbingshen committed Oct 19, 2021
1 parent be27160 commit 61a0fdd
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ private CompletableFuture<Long> conditionalUpdateData(byte[] data, long expectVe
}
updateFuture.complete(stat.getVersion());
}).exceptionally(ex -> {
if (ex instanceof MetadataStoreException.BadVersionException) {
if (ex.getCause() instanceof MetadataStoreException.BadVersionException) {
checkProducerIdBlockMetadata(data)
.thenAccept(updateFuture::complete).exceptionally(e -> {
updateFuture.completeExceptionally(e);
return null;
});
} else if (ex instanceof MetadataStoreException.NotFoundException) {
} else if (ex.getCause() instanceof MetadataStoreException.NotFoundException) {
log.error("Update of path {} with data {} and expected version {} failed due to {}",
KOP_PID_BLOCK_ZNODE, getProducerIdBlockStr(data), expectVersion,
"NoNode for path " + KOP_PID_BLOCK_ZNODE);
updateFuture.completeExceptionally(new Exception("NoNode for path " + KOP_PID_BLOCK_ZNODE));
} else {
log.error("Update of path {} with data {} and expected version {} exception: {}",
KOP_PID_BLOCK_ZNODE, getProducerIdBlockStr(data), expectVersion, ex);
updateFuture.completeExceptionally(new Exception("Error to update data.", ex));
KOP_PID_BLOCK_ZNODE, getProducerIdBlockStr(data), expectVersion, ex.getCause());
updateFuture.completeExceptionally(new Exception("Error to update data.", ex.getCause()));
}
return null;
});
Expand Down

0 comments on commit 61a0fdd

Please sign in to comment.