You need to iterate over the causes of the exception and print that out.
Something like this:
private String getMessage(Exception e) {
var result = e.getMessage();
var cause = e.getCause();
var maxDepth = 3;
while (cause != null && maxDepth-- > 0) {
result = cause.getMessage();
cause = cause.getCause();
}
return result;
}
Replace the 3 with your own logic.
See my exceptionmapper here: