How to get access to source BpmnError in error start event subprocess?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2013 02:31 AM
Hi,
I have a process whick called many times in a loop. If during execution some error occured I want to add a message into report. I try to make sub-process with error start event such this:
But inside of this sub-process I couldn't find any way to access the source exception (BpmnError or other). Does anybody know any standard way to do this or any workaround?
I have a process whick called many times in a loop. If during execution some error occured I want to add a message into report. I try to make sub-process with error start event such this:
<subProcess id="error-handling" name="error-handling" triggeredByEvent="true"> <startEvent id="start-error-event" name="start error event"> <errorEventDefinition /> </startEvent> <serviceTask id="add-error" name="add error to report" activiti:expression="${reports.addError(….)}"></serviceTask>….</subProcess>
But inside of this sub-process I couldn't find any way to access the source exception (BpmnError or other). Does anybody know any standard way to do this or any workaround?
Labels:
- Labels:
-
Archive
6 REPLIES 6

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2013 02:38 AM
Still no ideas? It seems that it is common case like in try-catch, when you have access to caught exception.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2013 03:01 AM
That's not how the BpmnError is meant to be used. You should look at it as a logical error with a simple id or errorRef property only. So it's not meant to pass along technical exceptions. If you want to do that it's best to use a process variable.
Best regards,
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2013 03:23 AM
Thanks for answer. I check source code and find class ErrorPropagation which implement logic for error handling. As I see not BpmnError and error code not set into the execution. So in my case (where I want to handle BpmnError's with all codes) I also can't get error code. Is this true?
Can you tell me Is it safe to correct activiti engine ErrorPropagation by this code:
<code>
public static void propagateError(BpmnError error, ActivityExecution execution) throws Exception {
execution.setVariableLocal("__errorCodeAlias", error.getErrorCode());
propagateError(error.getErrorCode(), execution);
}
</code>
Can you tell me Is it safe to correct activiti engine ErrorPropagation by this code:
<code>
public static void propagateError(BpmnError error, ActivityExecution execution) throws Exception {
execution.setVariableLocal("__errorCodeAlias", error.getErrorCode());
propagateError(error.getErrorCode(), execution);
}
</code>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2013 03:40 AM
What do you mean with "I also can't get error code" ? From where?
If you want to change the Activiti core logic that's of course up to you, but upgrading to a new version might be more difficult then.
Best regards,
If you want to change the Activiti core logic that's of course up to you, but upgrading to a new version might be more difficult then.
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2013 10:46 AM
As I understand there is no access to errorCode inside this sub-process which handles all kind of business errors. In curent activiti version the only way to separate logic between them is to define two sub-processes with error start events for different error codes.
Thanks a lot for answers.
Thanks a lot for answers.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2013 06:13 AM
Yes, that's correct. Two separate event sub processes would work. But it would be an improvement if you could also do this in the same event sub process. Could you raise a JIRA for this?
Thanks,
Thanks,
