@@ -660,8 +660,10 @@ private CompletableFuture<Void> internalUpdateNonPartitionedTopicProperties(Map<
660660 pulsar ().getBrokerService ().getTopicIfExists (topicName .toString ())
661661 .thenAccept (opt -> {
662662 if (!opt .isPresent ()) {
663- throw new RestException (Status .NOT_FOUND ,
664- getTopicNotFoundErrorMessage (topicName .toString ()));
663+ future .completeExceptionally (
664+ new WebApplicationException (getTopicNotFoundErrorMessage (topicName .toString ()),
665+ Status .NOT_FOUND ));
666+ return ;
665667 }
666668 ManagedLedger managedLedger = ((PersistentTopic ) opt .get ()).getManagedLedger ();
667669 managedLedger .asyncSetProperties (properties , new AsyncCallbacks .UpdatePropertiesCallback () {
@@ -681,6 +683,9 @@ public void updatePropertiesFailed(ManagedLedgerException exception, Object ctx)
681683 future .completeExceptionally (exception );
682684 }
683685 }, null );
686+ }).exceptionally (ex -> {
687+ future .completeExceptionally (ex );
688+ return null ;
684689 });
685690 return future ;
686691 }
@@ -717,8 +722,10 @@ private CompletableFuture<Void> internalRemoveNonPartitionedTopicProperties(Stri
717722 pulsar ().getBrokerService ().getTopicIfExists (topicName .toString ())
718723 .thenAccept (opt -> {
719724 if (!opt .isPresent ()) {
720- throw new RestException (Status .NOT_FOUND ,
721- getTopicNotFoundErrorMessage (topicName .toString ()));
725+ future .completeExceptionally (
726+ new WebApplicationException (getTopicNotFoundErrorMessage (topicName .toString ()),
727+ Status .NOT_FOUND ));
728+ return ;
722729 }
723730 ManagedLedger managedLedger = ((PersistentTopic ) opt .get ()).getManagedLedger ();
724731 managedLedger .asyncDeleteProperty (key , new AsyncCallbacks .UpdatePropertiesCallback () {
@@ -733,6 +740,9 @@ public void updatePropertiesFailed(ManagedLedgerException exception, Object ctx)
733740 future .completeExceptionally (exception );
734741 }
735742 }, null );
743+ }).exceptionally (ex -> {
744+ future .completeExceptionally (ex );
745+ return null ;
736746 });
737747 return future ;
738748 }
0 commit comments