cancel
Showing results for 
Search instead for 
Did you mean: 

Error end event without catching

ybrukau
Champ in-the-making
Champ in-the-making
Hello,

In User Guide it is pointed that
In case no matching boundary error event is found, the execution semantics default to the none end event semantics.

As I understood it means that in case no catching boundary event or start error event subprocess the process should complete usually.
But when I executed such process with Call Activity I received an exception
10:55:09,557 [main] ERROR org.activiti.engine.impl.interceptor.CommandContext  - Error while closing command context
org.activiti.engine.delegate.BpmnError: No catching boundary event found for error with errorCode 'errorCode', neither in same process nor in parent process (errorCode='errorCode') (errorCode='errorCode')


So is it a mistake in User Guide or a bug?

I have unit test but I can not attach it.
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
That sounds like a bug in the userguide. I've updated the userguide: see https://github.com/Activiti/Activiti/commit/9313380cdd14f507117f5a95b3ce1b151580d605

Thanks for reporting!

ybrukau
Champ in-the-making
Champ in-the-making
Hi,

Thanks for reply.
The problem that it is working differently depending on how the process with end error event was executed.
If it was started by RuntimeService, for example, it will finish silently without exception.
But if it would be started as sub process by CallActivity from other process it will throw an exception.
As soon as I can not attach zip archive with unit test. I will attach all files (first is java unit test, other two are bpmn processes)

Could you, please, take a look?
Yury

jbarrez
Star Contributor
Star Contributor
Yes, I'll check it tomorrow. Thanks for the unit test.

ybrukau
Champ in-the-making
Champ in-the-making
Hello,

I checked the source code. And I found class org.activiti.engine.impl.bpmn.helper.ErrorPropagation where error propagation is implemented.
What I found is it is done in two different ways depending on super process existing. If super process doesn't exist it prints log message and finishes. If super process exists it tries to find error event handler in super process (and upper hierarchy) and if there is no handler it throws BpmnError.
There is even TODO related to it I suppose:
<code>// TODO: merge two approaches (super process / regular process approach)</code>

So is it possible to add this fix to next release? And what is an expected behaviour in such case BpmnError or just log message?

Thanks,
Yury

frederikherema1
Star Contributor
Star Contributor
Thats indeed inconsistent behavior. As the error-event on a normal process now ends the process, it seems normal that, in case of a super-process being present, the exact same behavior is done: ending the process and logging.

Do you agree to the reasoning behind this? I can get that implemented by next release as it's a minor change. We do need to think about the implications on existing users that may rely on the exception…

ybrukau
Champ in-the-making
Champ in-the-making
I checked BPMN 2.0 spec and found next (page 247)
Error End Event
This type of End indicates that a named Error should be generated. All currently active threads in the particular Sub-Process are terminated as a result. The Error will be caught by a Catch Error Intermediate Event with the same errorCode or no errorCode which is on the boundary if the nearest enclosing parent Activity (hierarchically). The behavior of the Process is unspecified if no Activity in the hierarchy has such an  Error Intermediate Event. The system executing the process can define additional Error handling in this case, a common one being termination of the Process instance.

So it says that behavior is unspecified in this case and common handling is "termination of the process". But it is still not clear what to do with parent process.
From my point of view it is fine to end a process and log (probably with level Warning).
About relying on the exception. It is a bit strange for me because that is the reason for error start event.

Should I create a jira or do anything else?
Thanks,
Yury

frederikherema1
Star Contributor
Star Contributor
It indeed makes sense to just end the process, uncaught error-events are exceptional and I guess not many people will count on an exception being thrown in a subprocess.

No need for a jira, I'll alter the behavior.

frederikherema1
Star Contributor
Star Contributor
That throwing of the BPMNError is there for a reason (I should have checked first). In case it's a call-activity, the BPMNError thrown be caught be caught by the parent-process (which doesn't have an explicit super-execution relation-ship which prevent the BPMNError from bubbling up in a normal way).

ybrukau
Champ in-the-making
Champ in-the-making
Sorry, I did not understand your last comment.