refactor: `ShardNotOwnedException` should be send over `Mono.send()`
[demos/kafka/chat] / src / main / java / de / juplo / kafka / chat / backend / persistence / kafka / ChatRoomChannel.java
index f6f50cc..234554e 100644 (file)
@@ -369,12 +369,12 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
   {
     if (loadInProgress)
     {
-      throw new LoadInProgressException();
+      return Mono.error(new LoadInProgressException());
     }
 
     if (!isShardOwned[shard])
     {
-      throw new ShardNotOwnedException(shard);
+      return Mono.error(new ShardNotOwnedException(shard));
     }
 
     return Mono.justOrEmpty(chatrooms[shard].get(id));