Difference between throwing BpmnError and using transitions with ActivityExecution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2015 12:25 PM
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);
}
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);
}
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2015 08:27 AM
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,
Best regards,
