public class WrappedException extends RuntimeException
| Constructor and Description |
|---|
WrappedException(String message,
Throwable cause)
Initializes a new instance with the given message and cause.
|
WrappedException(Throwable cause)
Initializes a new instance with the given cause and its
message. |
| Modifier and Type | Method and Description |
|---|---|
<X extends Throwable> |
reThrowCauseAs(Class<X> xClass)
Rethrows the cause of this exception if it matches the given exception type,
otherwise this exception will be returned.
|
<X extends Throwable> |
reThrowCauseIf(Predicate<? super Throwable> condition,
Function<? super Throwable,X> mapping)
Applies a given
mapping to the cause of this exception if the given
condition applies and throws the result, otherwise this exception will be returned. |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic WrappedException(String message, Throwable cause)
public final <X extends Throwable> WrappedException reThrowCauseIf(Predicate<? super Throwable> condition, Function<? super Throwable,X> mapping) throws X extends Throwable
mapping to the cause of this exception if the given
condition applies and throws the result, otherwise this exception will be returned.X - The exception type that is intended as a result of the given mapping and that is thrown by this
method, if applicable.condition - A Predicate that is used to check the cause of this exception
for applicability.mapping - A Function that converts the cause of this exception to a
specific type of exception to be thrown at that point.X - The mapped exception, if present.X extends Throwablepublic final <X extends Throwable> WrappedException reThrowCauseAs(Class<X> xClass) throws X extends Throwable
X - The type of exception that is expected and, if applicable, thrown by this method.xClass - The Class that represents the type of exception that is expected.X - the cause of this exception, cast to the given type, if applicable.X extends ThrowableCopyright © 2024 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.