How to throw a BpmnError in script task using groovy?

cancel
Showing results for 
Search instead for 
Did you mean: 
vigneswaran
Active Member

How to throw a BpmnError in script task using groovy?

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
ymuwakki
Partner

Re: How to throw a BpmnError in script task using groovy?

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