cancel
Showing results for 
Search instead for 
Did you mean: 

How to throw a BpmnError in script task using groovy?

vigneswaran
Champ on-the-rise
Champ on-the-rise

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('ERR005Smiley Very HappyivideByZeroException') // This line doesn't work and throws an error "unable to resolve class BpmnError"

}

Please advise.

1 REPLY 1

ymuwakki
Champ on-the-rise
Champ on-the-rise

specify the fully qualified class name:  throw new org.activiti.engine.delegate.BpmnError("BusinessExceptionOccurred")