Skip to content
Snippets Groups Projects
Commit 7819067c authored by Arkerthan's avatar Arkerthan
Browse files

Better error message when RA custom conditions fail.

parent d579da9f
No related branches found
No related tags found
No related merge requests found
...@@ -151,7 +151,12 @@ globalThis.ruleAppliesP = function(rule, slave) { ...@@ -151,7 +151,12 @@ globalThis.ruleAppliesP = function(rule, slave) {
break; break;
case "custom": // user provided JS function case "custom": // user provided JS function
// TODO: This should use a cached Function instead of 'eval'ing // TODO: This should use a cached Function instead of 'eval'ing
flag = eval(cond.data)(slave); try {
flag = eval(cond.data)(slave);
} catch (e) {
// Put together a more useful message for the player. Does mean we are losing the stacktrace.
throw new Error(`Rule '${rule.name}' custom condition failed: '${e.message}'`);
}
break; break;
} }
if (!flag) { if (!flag) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment