Package spock.util

Class Exceptions


  • public abstract class Exceptions
    extends Object
    • Constructor Detail

      • Exceptions

        public Exceptions()
    • Method Detail

      • getRootCause

        public static Throwable getRootCause​(Throwable exception)
        Returns the innermost cause of the specified exception. If the specified exception has no cause, the exception itself is returned.
        Parameters:
        exception - an exception
        Returns:
        the root cause of the exception
      • getCauseChain

        public static List<Throwable> getCauseChain​(Throwable exception)
        Returns a list of all causes of the specified exception. The first element of the returned list is the specified exception itself; the last element is its root cause.
        Parameters:
        exception - an exception
        Returns:
        the exception's cause chain