Class NestedExceptionUtils

    • Method Detail

      • buildMessage

        public static String buildMessage​(String message,
                                          Throwable cause)
        Build a message for the given base message and root cause.
        Parameters:
        message - the base message
        cause - the root cause
        Returns:
        the full exception message
      • getRootCause

        public static Throwable getRootCause​(Throwable original)
        Retrieve the innermost cause of the given exception, if any.
        Parameters:
        original - the original exception to introspect
        Returns:
        the innermost exception, or null if none
        Since:
        4.3.9
      • getMostSpecificCause

        public static Throwable getMostSpecificCause​(Throwable original)
        Retrieve the most specific cause of the given exception, that is, either the innermost cause (root cause) or the exception itself.

        Differs from getRootCause(java.lang.Throwable) in that it falls back to the original exception if there is no root cause.

        Parameters:
        original - the original exception to introspect
        Returns:
        the most specific cause (never null)
        Since:
        4.3.9