cancel
Showing results for 
Search instead for 
Did you mean: 

Exception catching

fchatzia
Champ in-the-making
Champ in-the-making
Hi,

i would like to know if there is an easy way to catch exceptions in execution of one workflow. To be more specific i would like to have access to the info that is displayed in the console of the activiti server when something is going wrong.
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
The easiest way is to wrap all of the API-calls you do to activiti in a try-catch block and use the stack trace, this covers all synchronous errors. When you want to have job-executor-errors (e.g.. timers) you'll have to add custom JobHandlers in the configuration.

Another way, a bit deeper into activiti, is to include an additional Interceptor in the activiti command-stack. For example, see the "org.activiti.engine.impl.interceptor.LogInterceptor", which logs every command that happens in activiti. In your case, it would be something like this:


try {
  return next.execute(command);
} catch(Throwable t) {
// insert magic here
}

And plug your interceptor in, into the configuration using JAVA or wiring the property in spring:

public ProcessEngineConfigurationImpl setCustomPreCommandInterceptorsTxRequired(List<CommandInterceptor> customPreCommandInterceptorsTxRequired) {
    this.customPreCommandInterceptorsTxRequired = customPreCommandInterceptorsTxRequired;
    return this;
  }

fchatzia
Champ in-the-making
Champ in-the-making
Thank you