cancel
Showing results for 
Search instead for 
Did you mean: 

Error Listener ?

thomasl
Champ in-the-making
Champ in-the-making
Hello,

I have a system in which BPM scripts may be added by external users and are likely to throw technical exceptions (invalid scriptTask for instance). I understood that if RuntimeService.startProcessInstanceById (for instance) fails and throws an exception, the Activiti transaction is rolled back and no process instance exists in the database.
In such a case, the message in the thrown ActivitiException is sometimes not detailed enough to provide debugging information and I am looking for a hook to be able to retrieve information form the Activiti Engine after the process failed (exception in ScriptTaskActivityBehavior for instance) but before the transaction is rolled back. I have tried adding an ExecutionListener on the process but found out that it works only when the process succeeded. Is there any kind of error listener mechanism in which I may be able to run process queries such as retrieving executed activities list or process variables when an exception occurs ?

Thanks,

Tom
2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Can you catch exception and fire some kind of event?

Martin

Hi Martin,

Thanks for your reply. You mean the exception in the scriptTask or other activity ? Unfortunately not, since scripts are written by external partners. In addition, we may have exception elsewhere, for instance if a conditionExpression contains an unknown variable, a org.activiti.engine.impl.javax.el.PropertyNotFoundException is raised and the whole script fails.
In such a case, I would like to be able to retrieve a few process variables and the list of executed activities so that I am able, for instance, to find out how far the Activiti script went and rollback external non-transactional resources.

Thanks,

Thomas