I need to adjust all error messages going back to the caller of my integration flows so that I do not leak information, no matter if they are thrown as exception or handled as asynchronous errors. I'd like to avoid defining a custom error channel on every message handler. I have tried to attach a transformer to the default error channel without success:
@Bean
IntegrationFlow errorFlow() {
return IntegrationFlows.from("errorChannel")
.transform("{'status': 500, 'error': 'Internal Server Error'}")
.get();
}
Is there a central point where I can transform all outgoing error messages?