Package spock.util
Class Exceptions
- java.lang.Object
-
- spock.util.Exceptions
-
public abstract class Exceptions extends Object
-
-
Constructor Summary
Constructors Constructor Description Exceptions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Throwable>
getCauseChain(Throwable exception)
Returns a list of all causes of the specified exception.static Throwable
getRootCause(Throwable exception)
Returns the innermost cause of the specified exception.
-
-
-
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
-
-