lhotari commented on code in PR #25287:
URL: https://github.com/apache/pulsar/pull/25287#discussion_r2903795912


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:
##########
@@ -662,7 +661,10 @@ public CompletableFuture<Void> acknowledgeAsync(MessageId 
messageId,
         }
         TransactionImpl txnImpl = null;
         if (null != txn) {
-            checkArgument(txn instanceof TransactionImpl);
+            if (!(txn instanceof TransactionImpl)) {
+                return FutureUtil.failedFuture(new IllegalArgumentException(
+                        "Expected txn to be an instance of TransactionImpl, 
but got " + txn.getClass().getName()));
+            }

Review Comment:
   > If so, that would require quite a lot of code changes since all 
asynchronous tasks would need to be chained after the validation logic. Yes 
that's write. Extracting a method wouldn't help in this case.



-- 
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]

Reply via email to