Skip to content

Commit

Permalink
add try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
MakinoharaShoko committed Aug 22, 2024
1 parent c8e1593 commit e5aaee6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/webgal/src/Core/gameScripts/setVar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ export const setVar = (sentence: ISentence): IPerform => {
} else return e;
})
.reduce((pre, curr) => pre + curr, '');
const exp = compile(valExp2);
const result = exp();
let result = '';
try {
const exp = compile(valExp2);
result = exp();
} catch (e) {
logger.error('expression compile error', e);
}
webgalStore.dispatch(targetReducerFunction({ key, value: result }));
} else if (valExp.match(/true|false/)) {
if (valExp.match(/true/)) {
Expand Down

0 comments on commit e5aaee6

Please sign in to comment.