public class ExceptionUtils extends Object
| Constructor and Description |
|---|
ExceptionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
handleException(Object source,
String msg,
Throwable t)
Outputs the stacktrace along with the message on stderr and returns a
combination of both of them as string.
|
static String |
handleException(Object source,
String msg,
Throwable t,
boolean silent)
Generates a string from the stacktrace along with the message and returns
that.
|
static String |
throwableToString(Throwable t)
Returns the stacktrace of the throwable as string.
|
static String |
throwableToString(Throwable t,
int maxLines)
Returns the stacktrace of the throwable as string.
|
public static String throwableToString(Throwable t)
t - the throwable to get the stacktrace forpublic static String throwableToString(Throwable t, int maxLines)
t - the throwable to get the stacktrace formaxLines - the maximum number of lines to print, <= 0 for allpublic static String handleException(Object source, String msg, Throwable t)
source - the object that generated the exception, can be nullmsg - the message for the exceptiont - the exceptionpublic static String handleException(Object source, String msg, Throwable t, boolean silent)
source - the object that generated the exception, can be nullmsg - the message for the exceptiont - the exceptionsilent - if true then the generated message is not forwarded
to the source's loggerCopyright © 2017. All Rights Reserved.