public final class Exceptions extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Throwable> |
is(Throwable exception,
Class<T> type)
Returns
true if the given exception or one of its nested causes is an instance of the given type. |
static <T extends Throwable> |
unwrap(Throwable exception,
Class<T> type)
Unwrap the nested causes of given exception as long as until it is not an instance of the given type and then
return it.
|
public static <T extends Throwable> Throwable unwrap(Throwable exception, Class<T> type)
ServletException
or FacesException
.exception
- The exception to be unwrapped.type
- The type which needs to be unwrapped.public static <T extends Throwable> boolean is(Throwable exception, Class<T> type)
true
if the given exception or one of its nested causes is an instance of the given type.exception
- The exception to be checked.type
- The type to be compared to.true
if the given exception or one of its nested causes is an instance of the given type.