public class ExceptionUtils extends Object
Constructor and Description |
---|
ExceptionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends Throwable> |
findCause(Throwable t,
Class<T> type)
Locates a particular type of exception, working its way via the cause property of each exception in the exception
stack.
|
static <T extends Throwable> |
findCause(Throwable t,
Class<T> type,
PropertyAccess access)
Locates a particular type of exception, working its way down via any property that returns some type of Exception.
|
static String |
toMessage(Throwable exception)
Extracts the message from an exception.
|
public ExceptionUtils()
public static <T extends Throwable> T findCause(Throwable t, Class<T> type)
t
- the outermost exceptiontype
- the type of exception to search forpublic static <T extends Throwable> T findCause(Throwable t, Class<T> type, PropertyAccess access)
findCause(Throwable, Class)
as it works with older exceptions
that do not properly implement the (relatively new) cause property.t
- the outermost exceptiontype
- the type of exception to search foraccess
- used to access properties5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.