I often have DMN tables where I have a rule which captures an error condition. Hence my DMN output may often have a ‘status’ variable where I can put values such as ERROR. In the past I would test the status in a subsequent gate.
I wnated to try throwing a BpmnError from the rule task instead. I tried throwing a BpmnError using scripting in the input/output mapping. This was just treated as a runtime exception rather than caught as a BpmnError.
Hence it is syntactically correct to throw a BpmnError from a business rule task? If I am using DMN tables, how can I throw a BpmnError?
Update: I found that I can throw a BpmnError from an execution listener end event, however behaviour is strange. At the process level, the process behaves and process flow is as expected, however the engine JVM console reports a severe engine exception and prints a BPMN stacktrace without a jvm runtime stacktrace…
I think what you should do is explicitly add throw error event if your DMN decision result is matching some criteria to your business process.
Would that work for you?
With regard to the two process models below…
I can easily realise process model A.
What I wanted to implement was process model B as this is more consistent with BpmnError from service tasks etc. Hence I have tried to throw a BpmnError from script in output mappings and execution listener end events.
When I use a DMN table with scripting for output mapping, a BpmnError is treated as a java runtime error. If I use an execution listner on the end event and I test the return value from the DMN engine and throw a BpmnError, I get the desired behaviour, however as I mentioned, the console logs a sever engine exception with a BPMN stack trace.
Hence my question is, can I achieve process model B using a DMN decision table?
I’d like to see that, too, because it makes refactoring models much easier, if you could replace an existing service task with error handling by a DMN table. So implementation of the decision logic is changed, the whole error handling around it can stay like it was before.