AnsweredAssumed Answered

How to throw a BpmnError in script task using groovy?

Question asked by vigneswaran on Jun 18, 2018
Latest reply on Nov 12, 2018 by ymuwakki

Hi,

 

I have a process model with a simple start event -> User Task (get 2 inputs) -> Script Task (Validate inputs & and throw exception) -> end task. The script task is to divide the inputs, input1/input2. Say if input2 is 0, rather than getting an divide by zero exception, I would like to throw a BpmnError. The script task that I have is groovy. Please advise how to throw a BpmnError here.

 

if(execution.getVariable('input2') == 0) {

throw new BpmnError('ERR005:DivideByZeroException') // This line doesn't work and throws an error "unable to resolve class BpmnError"

}

 

Please advise.

Outcomes