cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between throwing BpmnError and using transitions with ActivityExecution

zlatan316
Champ on-the-rise
Champ on-the-rise
Hello,

I would like to know if there is any fundamental difference between throwing a BpmnError() in my catch block to trigger the ErrorBoundaryEvent and its flow, or using take() on a transition(see belwo code).
I know one is directing workflow and the other is using an event, but is there any particular reason to use one and not the other to drive error handling? I am using Activiti 5.14.

<code>
      public void execute(ActivityExecution execution) throws Exception {
          String var = (String) execution.getVariable("var");
      
          PvmTransition transition = null;
          try {
         String[] splitter = var.split("abc");
         transition = execution.getActivity().findOutgoingTransition("no-exception");
          } catch (Exception e) {
             transition = execution.getActivity().findOutgoingTransition("exception");
          }
          execution.take(transition);

      }
1 REPLY 1

trademak
Star Contributor
Star Contributor
A boundary error event is meant to show a functional error flow in the process definition / diagram. If you don't need that, you can also take the correct transition as well. Technically there's not a lot of difference.

Best regards,