public final class ExceptionHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
concatenateMessages(Throwable headOfChain)
Concatenates the messages of an exception chain.
|
static Throwable |
extractException(boolean first,
Throwable headOfChain,
Class<? extends Throwable>... types)
Extracts any of the given exception types from an exception chain.
|
static <T extends Throwable> |
extractException(Class<T> type,
boolean first,
Throwable headOfChain)
Extracts the given exception type from an exception chain.
|
static String |
getStackTraceAsString(Throwable cause)
Returns the stacktrace of a given exception as a string.
|
public static <T extends Throwable> T extractException(Class<T> type, boolean first, Throwable headOfChain)
T - the exception type to search fortype - the exception class to search forfirst - true if finds the first, else the last in chainheadOfChain - the head of chained exceptions, may be nullpublic static Throwable extractException(boolean first, Throwable headOfChain, Class<? extends Throwable>... types)
first - true if finds the first, else the last in chainheadOfChain - the head of chained exceptions, may be nulltypes - the exception classes to search forpublic static String concatenateMessages(Throwable headOfChain)
headOfChain - the head of chained exceptions, may be nullTentackle - a domain driven enterprise framework