public final class ExceptionUtil
extends java.lang.Object
| Constructor and Description |
|---|
ExceptionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.lang.Throwable> |
getInstanceOfCause(java.lang.Throwable throwable,
java.lang.Class<T> clazz)
Get a throwable or its causes are assignable from a class
|
static java.lang.Throwable |
getRootCause(java.lang.Throwable throwable)
Gets the route cause of a throwable
|
static boolean |
instanceOfCause(java.lang.Throwable throwable,
java.lang.Class<? extends java.lang.Throwable> clazz)
Checks if the throwable or its causes are assignable from a class
|
static void |
throwRuntime(java.lang.Throwable throwable)
Throws a Throwable by using the
toRuntime method |
static void |
throwRuntime(java.lang.Throwable throwable,
java.lang.String message)
Throws a Throwable by using the
toRuntime method |
static java.lang.RuntimeException |
toRuntime(java.lang.Throwable throwable)
Wraps a throwable to RuntimeException.
|
static java.lang.RuntimeException |
toRuntime(java.lang.Throwable throwable,
java.lang.String message)
Wraps a throwable to RuntimeException.
|
static java.lang.String |
toString(java.lang.Throwable throwable)
Converts a throwable to a String.
|
public static java.lang.String toString(java.lang.Throwable throwable)
public static boolean instanceOfCause(java.lang.Throwable throwable,
java.lang.Class<? extends java.lang.Throwable> clazz)
public static <T extends java.lang.Throwable> T getInstanceOfCause(java.lang.Throwable throwable,
java.lang.Class<T> clazz)
T - the type of classthrowable - the throwable that should be checkedclazz - the class that the found throwable should havepublic static java.lang.Throwable getRootCause(java.lang.Throwable throwable)
public static java.lang.RuntimeException toRuntime(java.lang.Throwable throwable)
public static java.lang.RuntimeException toRuntime(java.lang.Throwable throwable,
java.lang.String message)
message - the message that the wrapped throwable should havepublic static void throwRuntime(java.lang.Throwable throwable)
throws java.lang.RuntimeException
toRuntime methodjava.lang.RuntimeExceptionpublic static void throwRuntime(java.lang.Throwable throwable,
java.lang.String message)
throws java.lang.RuntimeException
toRuntime methodmessage - the message that the wrapped throwable should havejava.lang.RuntimeException