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
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.
-
Constructor Details
-
Exceptions
public Exceptions()
-
-
Method Details
-
getRootCause
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
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
-