Skip to content

Commit 54a94de

Browse files
committed
add catch to triggerActivity
1 parent d51ae60 commit 54a94de

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

server/controllers/handleRaceStart.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export const handleRaceStart = async (req, res) => {
1212
redisObj.set(profileId, JSON.stringify({ 0: false }));
1313

1414
const world = World.create(urlSlug, { credentials });
15-
world.triggerActivity({ type: WorldActivityType.GAME_ON, assetId });
15+
world.triggerActivity({ type: WorldActivityType.GAME_ON, assetId }).catch((error) => {
16+
console.error("Error triggering activity:", error);
17+
});
1618

1719
// move visitor to start line asset
1820
const startCheckpoint = (

server/utils/checkpoints/finishLineEntered.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export const finishLineEntered = async ({ credentials, currentElapsedTime, profi
2424
{ analytics: [{ analyticName: "completions", uniqueKey: profileId }] },
2525
);
2626

27-
if (newHighscore !== highscore) world.triggerActivity({ type: WorldActivityType.GAME_HIGH_SCORE, assetId });
27+
if (newHighscore !== highscore)
28+
world.triggerActivity({ type: WorldActivityType.GAME_HIGH_SCORE, assetId }).catch((error) => {
29+
console.error("Error triggering activity:", error);
30+
});
2831

2932
const visitor = await Visitor.get(visitorId, urlSlug, { credentials });
3033
const { x, y } = visitor.moveTo;

0 commit comments

Comments
 (0)