79522199

Date: 2025-03-20 07:48:01
Score: 0.5
Natty:
Report link

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:

https://github.com/quarkiverse/quarkus-fluentjdbc/blob/main/examples/src/main/java/com/acme/fluentjdbc/config/ExceptionMapper.java

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Serkan