}
}
private static String findLocalErrorEventHandler(ActivityExecution execution, String errorCode) {
PvmScope scope = execution.getActivity();
while (scope != null) {
@SuppressWarnings("unchecked")
List<ErrorEventDefinition> definitions = (List<ErrorEventDefinition>) scope.getProperty(BpmnParse.PROPERTYNAME_ERROR_EVENT_DEFINITIONS);
if(definitions != null) {
// definitions are sorted by precedence, ie. event subprocesses first.
for (ErrorEventDefinition errorEventDefinition : definitions) {
if(errorEventDefinition.catches(errorCode)) {
return scope.findActivity(errorEventDefinition.getHandlerActivityId()).getId();
}
}
}
// search for error handlers in parent scopes