[AB-254] fixing exception for unSuggest in case the suggestion message has been deleted

This commit is contained in:
Sheldan
2021-05-24 17:53:58 +02:00
parent 7d30afbd2c
commit d7cc7f579f

View File

@@ -239,7 +239,12 @@ public class SuggestionServiceBean implements SuggestionService {
throw new UnSuggestNotPossibleException();
}
return messageService.deleteMessageInChannelInServer(suggestion.getServer().getId(), suggestion.getChannel().getId(), suggestion.getMessageId())
.thenAccept(unused -> self.deleteSuggestion(suggestionId, serverId));
.thenAccept(unused -> self.deleteSuggestion(suggestionId, serverId))
.exceptionally(throwable -> {
log.info("Suggestion message for suggestion {} in server {} did not exist anymore - ignoring.", suggestionId, serverId);
self.deleteSuggestion(suggestionId, serverId);
return null;
});
}
@Override