Class ExceptionUtils


  • public class ExceptionUtils
    extends Object
    Utilities for reading a stacktrace.
    • Method Detail

      • getStackTrace

        public static String getStackTrace​(Throwable aThrowable)
        Prints the stacktrace of an exception to a String. Why this functionality is not included in the standard java libraries is anybody's guess.
        Parameters:
        aThrowable - An exception
        Returns:
        String containing a stacktrace of exception aThrowable. Will return the string "null" and a linebreak if aThrowable is null.
      • getSQLExceptionCause

        public static String getSQLExceptionCause​(SQLException e)
        SQLExceptions have their own stack of causes accessed via the getNextException() method. This utility provides a string representation of those causes for use in logging or rethrowing
        Parameters:
        e - the original top-level exception
        Returns:
        a String describing the exception