public final class ExceptionUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Throwable |
firstCause(Throwable throwable)
Returns the specified
throwable if there is no cause found in it (throwable.getCause() == null). |
static String |
getErrorMessage(Throwable e) |
static String |
getErrorMessage(Throwable e,
boolean withExceptionClassName) |
static String |
getMessage(Throwable e)
Gets the error msg.
|
static String |
getStackTrace(Throwable throwable)
Gets the stack trace from a Throwable as a String.
|
static boolean |
hasCause(Throwable throwable,
Class<? extends Throwable> type) |
static boolean |
hasCause(Throwable throwable,
Predicate<? super Throwable> predicate) |
static boolean |
hasIOCause(Throwable throwable) |
static boolean |
hasSQLCause(Throwable throwable) |
static List<Throwable> |
listCause(Throwable throwable) |
static RuntimeException |
toRuntimeException(Throwable e)
To runtime exception.
|
public static RuntimeException toRuntimeException(Throwable e)
e - public static String getMessage(Throwable e)
e - public static String getStackTrace(Throwable throwable)
Gets the stack trace from a Throwable as a String.
The result of this method vary by JDK version as this method
uses Throwable.printStackTrace(java.io.PrintWriter).
On JDK1.3 and earlier, the cause exception will not be shown
unless the specified throwable alters printStackTrace.
Throwable to be examinedprintStackTrace(PrintWriter) methodpublic static boolean hasCause(Throwable throwable, Predicate<? super Throwable> predicate)
public static boolean hasSQLCause(Throwable throwable)
public static boolean hasIOCause(Throwable throwable)
public static Throwable firstCause(Throwable throwable)
throwable if there is no cause found in it (throwable.getCause() == null).throwable - Copyright © 2021. All rights reserved.