cancel
Showing results for 
Search instead for 
Did you mean: 

BpmnError catching

mikuc
Champ in-the-making
Champ in-the-making
Hello everyone,

Please I need some advice from you. I have som processes, that are using the same service task to find supervisor(manager) for logged user in LDAP using delegate expression, because every process is an osgi bundle.
How can i catch an BpmnError an send this error to another task e.g. to it admins.

[IMG]http://i62.tinypic.com/2qx858m.jpg[/IMG]

Is it possible to catch error on a service task an send it to userTask, or i need to use another path in case some exception occurs?

Here is my service task

<code>

import java.util.List;

imports…

public class  Supervisor implements JavaDelegate {
   
  public void  execute(DelegateExecution execution) throws Exception {
     try {
    FindSuperiorLogic();

     } catch (Exception  e) {
        execution.setVariable("bpmError", e.toString());
        throw new BpmnError("BusinessExceptionOccurred");
       }
  }

<code>

Error boundary event should catch the "BusinessExceptionOccurred" and go to usertask to fix the error.

Thanks a lot for help and advice
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Yes the Boundary error event should catch the error thrown from the service task. Isn't it working for you?

Best regards,

mikuc
Champ in-the-making
Champ in-the-making
No, at the moment the process will start but no task is generated, maybe there is another problem with identityservice or ldap integration.
But if it should catch the error event then great. I read on the userguide that "Defining a boundary error event makes most sense on an embedded subprocess, or a call activity, as a subprocess creates a scope for all activities inside the subprocess. Errors are thrown by error end events. Such an error will propagate its parent scopes upwards until a scope is found on which a boundary error event is defined that matches the error event definition"

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

have a look on the following jUnit test in activiti source:
org.activiti.spring.test.servicetask.BoundaryErrorEventSpringTest

Regards
Martin