Open b1conrad opened 2 years ago
But running it through krl-compiler --verify didn't report an error.
krl-compiler --verify
Trying it without the --verify flag... No error reported, but the generated Javascript code includes
--verify
var url3 = $state.setting["url"]; this.rule.state = Object.assign({}, $state, { "setting": {} }); const url3 = await get1($ctx, [...]);
so the error isn't detected until the JS compiled code is brought into the pico engine in order to evaluate the global block.
global
It is a KRL programmer error! But it would be nice if the krl-compiler could catch it!
krl-compiler
rule installApp { select when byu_hr_manage_apps new_app url re#(.+)# setting(url) pre { url = event:attr("_headers").get("referer") } if url then send_directive("_redirect",{"url":url}) fired { raise wrangler event "install_ruleset_request" attributes {"url":url,"tx":meta:txnId} } }
Meanwhile, it can be easily fixed in KRL by not re-using a variable name from setting within the prelude.
setting
pre
But running it through
krl-compiler --verify
didn't report an error.Trying it without the
--verify
flag... No error reported, but the generated Javascript code includesso the error isn't detected until the JS compiled code is brought into the pico engine in order to evaluate the
global
block.It is a KRL programmer error! But it would be nice if the
krl-compiler
could catch it!Meanwhile, it can be easily fixed in KRL by not re-using a variable name from
setting
within thepre
lude.