Skip to content

Commit

Permalink
Fix crash on request error
Browse files Browse the repository at this point in the history
  • Loading branch information
lindlof committed Dec 6, 2020
1 parent b7489aa commit 06209be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion web/src/components/GameTicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const GameTicker = (props: React.PropsWithChildren<Props>) => {
useEffect(() => {
if (!client || !game) return;
const timer = setInterval(async () => {
const update = await Game.tick(client, game);
let update: Game.TickUpdate | undefined;
try {
update = await Game.tick(client, game);
} catch {}
if (update === undefined) return;
setGame((g: Game.Game): Game.Game | undefined => {
if (!update) return;
Expand Down
2 changes: 1 addition & 1 deletion web/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,5 @@ const claimInactivity = async (client: SecretJS.SigningCosmWasmClient, game: Gam
}
};

export type { Game, Round };
export type { Game, Round, TickUpdate };
export { Stage, create, tick, playHandsign, claimInactivity, Result, defaults };

0 comments on commit 06209be

Please sign in to comment.