public final class ExceptionUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
ExceptionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends java.lang.Exception> |
conditionallyReThrow(T e,
boolean rethrow,
java.util.logging.Logger logger,
java.lang.String m,
java.util.logging.Level level)
Based on the rethrow parameter, either rethrows the supplied exception or logs the provided message at the given level.
|
static java.lang.String |
exceptionStackTraceAsString(java.lang.Throwable t)
Gets the stack trace of the provided throwable as a string.
|
public static java.lang.String exceptionStackTraceAsString(java.lang.Throwable t)
t
- the exception to get the stack trace for.public static <T extends java.lang.Exception> void conditionallyReThrow(T e, boolean rethrow, java.util.logging.Logger logger, java.lang.String m, java.util.logging.Level level) throws T extends java.lang.Exception
T
- the type of the exception to be conditionally rethrown.e
- the exception to rethrow if rethrow is true
.rethrow
- whether to rethrow an exception or just log the provided message.logger
- the logger to print the message with.m
- the message to log if rethrow is false
.level
- the level of the logged message.T
- if rethrow is true
.T extends java.lang.Exception