Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 3.0.0-M1, 3.0.0-M4
-
Fix Version/s: 3.0.0
-
Component/s: Core: Exception Handling
-
Labels:None
-
User impact:High
-
Affects Docs:Yes
-
Similar Issues:None
Description
Problem: Having declared both transport and business-level (custom) transformers on the endpoint, it's not always clear whether service or connector exception strategy would be invoked in case of a failure for such mixed set.
Solution: Exception handling code can be made smarter:
- Transport transformers can implement a marker interface like HandleByConnectorExceptionStrategy
- Custom transformers will not change, and by convention will be considered for handling by a service exception strategy
- applyAllTransformers() catch block will dig into TransformerException to see which transformer exactly caused an issue (probably all info is already there, otherwise just pass in 'this' ref from transformer when throwing exception).
- Next, either connector.handleException() or service.handleException() should be invoked
There could be cases when more customization would be needed, but this is the first step to make it possible later.
Instead of the marker interface I'd rather add a method (like exceptionsAreHandledByConnector) to the Transformer interface. Less interfaces, same effect.