public class SuppressedException extends RuntimeException
Modifier | Constructor and Description |
---|---|
protected |
SuppressedException(Throwable cause) |
Modifier and Type | Method and Description |
---|---|
static <E extends Throwable> |
suppress(Runnable runnable) |
static <T,E extends Throwable> |
suppress(Supplier<T> supplier) |
static <E extends Throwable> |
unwrapExceptionCause(SuppressedException suppressed,
Class<E> exceptionClass) |
static void |
unwrapSuppressedException(Runnable runnable) |
static <E extends Throwable> |
unwrapSuppressedException(Runnable runnable,
Class<E> exception) |
static <T> T |
unwrapSuppressedException(Supplier<T> supplier) |
static <T,E extends Throwable> |
unwrapSuppressedException(Supplier<T> supplier,
Class<E> exceptionClass) |
static SuppressedException |
wrapException(Throwable cause) |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
protected SuppressedException(Throwable cause)
public static <T,E extends Throwable> T suppress(Supplier<T> supplier)
E
- The exception type.supplier
- A supplier object which may throw some exceptionpublic static <E extends Throwable> void suppress(Runnable runnable)
E
- The exception type.runnable
- A supplier object which may throw some exceptionpublic static SuppressedException wrapException(Throwable cause)
cause
- The original cause.public static <T,E extends Throwable> T unwrapSuppressedException(Supplier<T> supplier, Class<E> exceptionClass) throws E extends Throwable
T
- The generic return type.E
- The exception type.supplier
- A supplier that will throw SuppressedExceptionexceptionClass
- The class type to intercept and withUncheckedThrowable.E
- The original exception, that was wrapped into a SuppressedException.E extends Throwable
public static <T> T unwrapSuppressedException(Supplier<T> supplier) throws Throwable
T
- The return type generic.supplier
- A supplier that throws SuppressedExceptions.Throwable
- any throwable cause attached to the SuppressedExceptionpublic static <E extends Throwable> void unwrapSuppressedException(Runnable runnable, Class<E> exception) throws E extends Throwable
E
- The exception class generic type.runnable
- A runnable that throws suppressed exceptionsexception
- The exception class to intercept.E
- The intercepted exception.E extends Throwable
public static void unwrapSuppressedException(Runnable runnable) throws Throwable
runnable
- A runnable that throws suppressed exceptionsThrowable
- Any throwable caused that is intercepted from caught Suppressed Exceptions.public static <E extends Throwable> Optional<E> unwrapExceptionCause(SuppressedException suppressed, Class<E> exceptionClass)
E
- The exception class type genericsuppressed
- The caught suppressed exceptionexceptionClass
- The exception class type to try extract from the caught exceptionCopyright © 2017. All rights reserved.