AnsweredAssumed Answered

Difference between throwing BpmnError and using transitions with ActivityExecution

Question asked by zlatan316 on May 11, 2015
Latest reply on May 13, 2015 by trademak
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);

      }

Outcomes