Skip to content

Commit

Permalink
better erros for new game'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcosulich committed Jul 9, 2023
1 parent b7b7f81 commit 8bc375a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,11 @@ const onWalletConnected = async ({ signer }) => {

const { events } = data;
const gameData = events.find((e) => e.type === `${originalContractAddress}::game_8192::NewGameEvent8192`)
if (!gameData) {
eById("create-error-error-message").innerHTML = `Unable to find create event in ${JSON.stringify(data, null, 2)}`;
modal.open("create-error", "container");
return;
}
const { game_id, packed_spaces, score } = gameData.parsedJson;
const game = {
address: game_id,
Expand Down
5 changes: 5 additions & 0 deletions js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,11 @@ const onWalletConnected = async ({ signer }) => {

const { events } = data;
const gameData = events.find((e) => e.type === `${originalContractAddress}::game_8192::NewGameEvent8192`)
if (!gameData) {
eById("create-error-error-message").innerHTML = `Unable to find create event in ${JSON.stringify(data, null, 2)}`;
modal.open("create-error", "container");
return;
}
const { game_id, packed_spaces, score } = gameData.parsedJson;
const game = {
address: game_id,
Expand Down

0 comments on commit 8bc375a

Please sign in to comment.