Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created August 22, 2011 22:15
Show Gist options
  • Save edorcutt/1163781 to your computer and use it in GitHub Desktop.
Save edorcutt/1163781 to your computer and use it in GitHub Desktop.
Test Ruleset for in ruleset error handling
ruleset a169x390 {
meta {
name "Demo-Error-Handling"
description <<
Test Ruleset for in ruleset error handling
http://www.windley.com/archives/2011/05/error_handling_in_krl.shtml
http://docs.kynetx.com/docs/Error_handling
http://ktest.heroku.com/a169x390
>>
author "Ed Orcutt, LOBOSLLC"
logging on
}
dispatch { }
global { }
// ------------------------------------------------------------------------
rule throw_error {
select when pageview ".*"
{
notify("Error Handling Demo", "throw an error ...") with sticky = true;
}
fired {
error info "a user generated error"
}
}
// ------------------------------------------------------------------------
rule catch_error {
select when system error or user error
pre {
genus = event:param("genus");
species = event:param("species");
level = event:param("level");
msg = event:param("msg");
rule_name = event:param("rule_name");
rule_id = event:param("rid");
msgHeader = << #{level} in #{rule_id}:#{rule_name} >>;
msgBody = << #{genus}:#{species} #{msg} >>;
}
{
notify(msgHeader, msgBody) with sticky = true;
}
}
// ------------------------------------------------------------------------
// Beyond here there be dragons :)
// ------------------------------------------------------------------------
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment