fix: GREEN - Fixed NPE in `ShardedChatHome.getChatRoom()` for foreign shard
authorKai Moritz <kai@juplo.de>
Fri, 18 Aug 2023 12:09:02 +0000 (14:09 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 18 Aug 2023 15:18:41 +0000 (17:18 +0200)
commit8d8ad4fbe742d49c498993e127f7a4ab72b20020
tree286d04f49e483b1da33fe428fc3558eeab2ed297
parent579188d824ed2718b03e7feecf6f8c6813888394
fix: GREEN - Fixed NPE in `ShardedChatHome.getChatRoom()` for foreign shard

* `ShardedChatHome.getChatRoom(UUID)` know checks, if a `ChatHome` exists
  for the selected shard.
* If no `ChatHome` exists, a `ShardNotOwnedException` is thrown.
* The `ChatBackendControllerAdvice` translates the exception to an error
  of type 404 - NOT FOUND, to fullfill the defined expectations.
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java
src/main/java/de/juplo/kafka/chat/backend/domain/ShardNotOwnedException.java [new file with mode: 0644]
src/main/java/de/juplo/kafka/chat/backend/domain/ShardedChatHome.java