Add guards to the drop and reroll commands in case the card fetcher fails #449

Merged
Vylpes merged 3 commits from feature/CD-446 into hotfix/0.9.1 2025-05-24 10:39:34 +01:00
Showing only changes of commit 4ea402bcd8 - Show all commits

View file

@ -42,7 +42,7 @@ export default class GetUnclaimedCardsHelper {
.filter(x => !claimedCards.find(y => y.CardNumber == x.id));
if (!allCards) {
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", "No cards found to randomise from");
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `No cards found to randomise from, User Id: ${userId}, rarity: ${rarity}`);
return undefined;
};
@ -52,7 +52,7 @@ export default class GetUnclaimedCardsHelper {
const card = allCards[randomCardIndex];
if (!card) {
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `Card not found in index, ${randomCardIndex} of ${allCards.length}`);
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `Card not found in index, ${randomCardIndex} of ${allCards.length}, User Id: ${userId}, rarity: ${rarity}`);
return undefined;
}
@ -61,7 +61,7 @@ export default class GetUnclaimedCardsHelper {
.find(x => x.cards.includes(card));
if (!series) {
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `Series not found for card ${card.id}`);
AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `Series not found for card ${card.id}, User Id: ${userId}, rarity: ${rarity}`);
return undefined;
}