public class WrappedFragileException
extends java.lang.RuntimeException
In such cases, this runtime exception is used to wrap the given exception, and thrown instead.
Constructor and Description |
---|
WrappedFragileException(java.lang.Exception exception)
Create a wrapped fragile exception.
|
WrappedFragileException(java.lang.Exception exception,
java.lang.String additionalMessage)
Create a wrapped fragile exception with an additional message.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Exception |
getException()
Get the exception.
|
void |
rethrow()
Throw the wrapped exception.
|
<E extends java.lang.Exception> |
rethrow(java.lang.Class<E> xType)
Rethrow the wrapped exception as an expected type.
|
public WrappedFragileException(@NotNull java.lang.Exception exception)
exception
- fragile exception to be wrapped@NotNull public java.lang.Exception getException()
public void rethrow() throws java.lang.Exception
java.lang.Exception
- the original exceptionpublic <E extends java.lang.Exception> void rethrow(@NotNull java.lang.Class<E> xType) throws E extends java.lang.Exception
exception
is not
of the correct type this method will throw a
ClassCastException
.E
- expected typexType
- expected type as classE
- expected exception typejava.lang.ClassCastException
- if wrapped exception is of a different typeE extends java.lang.Exception