I found that it’s impossible to return meaningful errors for exceptions thrown in middleware services, when called via REST interface.
The offending code is in the
, specifically in the
There you simply throw a generic exception with a static error message (“Error on service method invoke”), while I’d like a simple way to handle custom exceptions, converting them in POJO responses.
You should implement an external bean whose scope is to handle service exceptions in a custom way (moving the default implementation there, to be overridden when needed).