question about using DMN in a BPMN process, using the Decision Task.
As far as I can see, when a Decistion task executes, but no rules match, then no errors are thrown. The execution simply continues, and no processVariables are created/updated from of the decisiontable output columns.
As an administrator, however, I would like the Decision Task to throw an error when no rules match, because it probably means that I have (a) made mistakes or forgot something in the decisiontable, (b) the input process variables contain values that I didn’t foresee.
Is there anything in the DMN spec that dictates what to do when not a single rule matches?
I’m thinking about creating an extra boolean property “throw error when no rules match” on the Decision Task.
good or bad idea?
Related, appearently the Decision Table task even doesn’t throw an error when the DMN execution fails (e.g. when one of the referenced input process variables doesn’t exist). We have proposed a fix PR for this: https://github.com/flowable/flowable-engine/pull/657
Currently the DecisionExecutionAuditContainer contains a failed flag to indicate that the DMN evaluation was not correct. But the DmnActivityBehavior doesn’t throw an error in that case right now. Your PR I think is a good proposal, but I think it should be configurable on the decision task if you want it to throw an error in that case. The same for no rules being hit. Something like throwErrorOnFail and throwErrorOnNoHits. Then everyone can choose how they want it to behave. Does that sound like a good solution?
fully agree with throwErrorOnNoHits to be optional. We’ll make a PR for this.
For the throwErrorOnFail, I am not so convinced that there would exist usecases in which you wouldn’t want to throw an error. It feels a bit as if script task would continue when the script execution fails. Are you really sure about the need for continue without error ? Fine for me, but just a double-check please.
I think you are right, when the decision execution fails there’s no reason to not throw an exception.
I have updated the PR with a flag.