apache / incubator-kie-issues

Apache License 2.0
12 stars 1 forks source link

Implement ErrorHandler for conditions (LHS) in drools #379

Open gitgabrio opened 1 year ago

gitgabrio commented 1 year ago

Drl definition

Scenario 1: m : HashMap( this["age"] > 14 && this["clicks"] + this["visits"] > 500 )

For a rule with conditions like the above, the second part this["clicks"] + this["visits"] > 500 throws an exception if any of the parameters are missing in the HashMap. When an exception is thrown in any of the rules in a kie session, the whole kie session gets terminated without any further execution or rule outcome.

Scenario 2: m : HashMap( Double.parseDouble(this["visits"]) > 500 )

Here, if the visits param is null, then there will be an exception thrown from the rule and the whole kie session will be affected.

Scenario one is available in Drools sample app

mariofusco commented 1 year ago

https://kie.zulipchat.com/#narrow/stream/232677-drools/topic/Rule.20condition.20exception.20handling.20in.20drools/near/372308202