Skip to content

Commit 13feef0

Browse files
authored
Merge pull request #278 from mcdemarco/develop
Note current function when throwing errors
2 parents ec70618 + 46c9225 commit 13feef0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/games/frogger.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export class FroggerGame extends GameBase {
335335
//The advanced case is handled inside this function, unlike in getNextForward.
336336
const cardObj = Card.deserialize(card);
337337
if (cardObj === undefined) {
338-
throw new Error(`Could not deserialize the card ${card}`);
338+
throw new Error(`Could not deserialize the card ${card} in checkNextForward.`);
339339
}
340340

341341
if (this.variants.includes("advanced") && cardObj.rank.uid !== this.courtrank) {
@@ -473,7 +473,7 @@ export class FroggerGame extends GameBase {
473473
private getSuits(cardId: string): string[] {
474474
const card = Card.deserialize(cardId);
475475
if (card === undefined) {
476-
throw new Error(`Could not deserialize the card ${cardId}`);
476+
throw new Error(`Could not deserialize the card ${cardId} in getSuits.`);
477477
}
478478
const suits = card.suits.map(s => s.uid);
479479
return suits;
@@ -568,7 +568,7 @@ export class FroggerGame extends GameBase {
568568
//Bouncing occurs when an Ace or Crown was played, not a number card or a Court.
569569
const card = Card.deserialize(cardId);
570570
if (card === undefined) {
571-
throw new Error(`Could not deserialize the card ${cardId}`);
571+
throw new Error(`Could not deserialize the card ${cardId} in moveNeighbors`);
572572
}
573573

574574
const rank = card.rank.name;
@@ -864,7 +864,7 @@ export class FroggerGame extends GameBase {
864864
let to;
865865
const cardObj = Card.deserialize(card);
866866
if (cardObj === undefined) {
867-
throw new Error(`Could not deserialize the card ${card}`);
867+
throw new Error(`Could not deserialize the card ${card} in randomMove.`);
868868
}
869869

870870
if (this.variants.includes("advanced") && cardObj.rank.uid !== this.courtrank) {
@@ -1656,7 +1656,7 @@ export class FroggerGame extends GameBase {
16561656
const card = this.board.get(cell)!;
16571657
const cardObj = Card.deserialize(card);
16581658
if (cardObj === undefined) {
1659-
throw new Error(`Could not deserialize the card ${card}`);
1659+
throw new Error(`Could not deserialize the card ${card} in render.`);
16601660
}
16611661
const suits = cardObj!.suits;
16621662

0 commit comments

Comments
 (0)