public class ExceptionUtils extends Object
Constructor and Description |
---|
ExceptionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends Throwable> |
getCause(RuntimeException rex) |
static <T extends Throwable> |
unwrapCause(Throwable ex,
Class<T> exceptionToSearch)
Unwraps the cause of 'ex' until we find one of class 'exceptionToSearch'
|
static Throwable |
unwrapInvocationTargetException(RuntimeException rex)
Unwrap any throwable that Spring doesn't wrap properly.
|
static RuntimeException |
unwrapInvocationTargetExceptionForRuntimeExceptions(RuntimeException rex)
Same as
unwrapInvocationTargetException(java.lang.RuntimeException) , except it only returns RuntimeExceptions. |
static RuntimeException |
wrapIntoRuntimeException(Exception exception)
Returns the exception if it is a RuntimeException, otherwise wrap it into a RuntimeException,
so it can be used as `throw wrapIntoRuntimeException(exception);`
|
public static Throwable unwrapInvocationTargetException(RuntimeException rex)
public static RuntimeException unwrapInvocationTargetExceptionForRuntimeExceptions(RuntimeException rex)
unwrapInvocationTargetException(java.lang.RuntimeException)
, except it only returns RuntimeExceptions.public static RuntimeException wrapIntoRuntimeException(Exception exception)
public static <T extends Throwable> T unwrapCause(Throwable ex, Class<T> exceptionToSearch)
public static <T extends Throwable> T getCause(RuntimeException rex)
Copyright © 2022 Requirement Yogi. All rights reserved.