Please consider my scenario: a specific external service "X" accessible by a WebService interface and an ESB-aware service "A" on my ESB that connects to that service and translates the results. There's also an another ESB-aware service "B" with a JBR listener to accept client connections that communicates with the service "A".
I'm thinking of an elegant way of handling exceptions it the service "X". Currently such exceptions are caught in the service "A" but I'd like to forward some information about the error to the clients, through the service "B". An ESB message has a "Fault" field that has a "setCause(Throwable)" method. Would passing an exception from "X", caught in "A" to "B" using Message's Fault field be reasonable? The drawback I see is the need to check "if (message.getFault().getCause() == null)" in the service "B", but perhaps there's a better way?