Flowable Engine throws FlowableExceptions in almost every case, and sometimes it is difficult to write proper <flowable:mapException> tags to cover them since we can’t know the root cause if we want to handle them differently.
For an example:
org.flowable.http.HttpActivityExecutor wraps ClientProtocolException, IOException, URISyntaxException and exceptions thrown by httpRequestHandler or httpResponseHandler into FlowableException. If we use <flowable:mapException> we cannot distinct if the root cause is because of an invalid URL or because of our custom HttpRequestHandler.
I would like to propose a new attribute for the <flowable:mapException> tag, rootCause which would allow to map exceptions based on the root cause of the exception.
For an example:
<flowable:mapException errorCode="myErrorCode1" rootCause="java.net.URISyntaxException">org.flowable.SomeException</flowable:mapException> which would handle all org.flowable.SomeException caused by java.net.URISyntaxException.
Does this sound like wrong design or a good feature? If it sounds useful, I would happily submit a PR with an example.
Would however catch org.flowable.SomeException ONLY if it was caused by a java.net.URISyntaxException, something like throw new SomeException((java.net.URISyntaxException) e)
The difference here is that I would like to handle FlowableException only if it was caused by a specific exception. Flowable engine wraps all exceptions and there is currently no way (that I know of) on how to handle different causes through BPMN flow using flowable:mapException.
Ok, i see your point. I understood it indeed backwards. Thanks for the proper clarification :-).
Your idea makes indeed sense and would be good to have.
Alternatively, I was thinking that having a specific (new) type of exception would also solve this maybe better? So instead of throwing FlowableException, have specific FlowableXyzException instead. Wdyt?