Skip to content

Commit

Permalink
Prevent exceptions in TurnStart Rules from breaking the gameplay.
Browse files Browse the repository at this point in the history
  • Loading branch information
dom111 committed May 6, 2023
1 parent 14324cb commit aecc184
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Events/Player/turn-start.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Events/Player/turn-start.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Events/Player/turn-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const getEvents: (
[
'player:turn-start',
(player: Player): void => {
ruleRegistry.process(TurnStart, player);
try {
ruleRegistry.process(TurnStart, player);
} catch (e) {
console.error(e);
}

const client = clientRegistry.getByPlayer(player);

Expand Down
2 changes: 1 addition & 1 deletion Rules/World/built.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const getRules: (
(promise: Promise<void>, client: Client): Promise<void> =>
promise.then(async () => {
const player = client.player(),
CivilizationChoice = await client.chooseFromList(
CivilizationChoice = await client.chooseFromList(
new ChoiceMeta(
civilizationRegistry.entries(),
'choose-civilization'
Expand Down

0 comments on commit aecc184

Please sign in to comment.