Package spock.util

Class Exceptions


  • public abstract class Exceptions
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Exceptions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.Throwable> getCauseChain​(java.lang.Throwable exception)
      Returns a list of all causes of the specified exception.
      static java.lang.Throwable getRootCause​(java.lang.Throwable exception)
      Returns the innermost cause of the specified exception.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Exceptions

        public Exceptions()
    • Method Detail

      • getRootCause

        public static java.lang.Throwable getRootCause​(java.lang.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 java.util.List<java.lang.Throwable> getCauseChain​(java.lang.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