Exception catching

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2012 05:46 AM
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.
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.
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2012 09:27 AM
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:
And plug your interceptor in, into the configuration using JAVA or wiring the property in spring:
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;
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2012 10:54 AM
Thank you
