E
- the type of the exception to use as a wrapper exception if all else fails.public class ExceptionUnwrapper<E extends java.lang.Exception>
extends java.lang.Object
Constructor and Description |
---|
ExceptionUnwrapper(java.lang.Class<E> expectedExceptionType,
ExceptionWrapper<E> exceptionWrapper) |
Modifier and Type | Method and Description |
---|---|
E |
unwrapException(java.lang.Exception e)
Unwrap the exception
e , immediately throwing an RuntimeException s
or Error s, returning an exception of type E because we found it
as a cause within some other exception wrapper or because we called the
ExceptionWrapper instance supplied when this instance was constructed. |
static <E extends java.lang.Exception> |
unwrapException(java.lang.Exception e,
java.lang.Class<E> expectedExceptionType,
ExceptionWrapper<E> wrapper) |
public ExceptionUnwrapper(java.lang.Class<E> expectedExceptionType, ExceptionWrapper<E> exceptionWrapper)
public E unwrapException(java.lang.Exception e)
e
, immediately throwing an RuntimeException
s
or Error
s, returning an exception of type E
because we found it
as a cause within some other exception wrapper or because we called the
ExceptionWrapper
instance supplied when this instance was constructed.e
- the exception to unwrap/rewrap.E
java.lang.RuntimeException
- if a RuntimeException
was encountered as an inner exception while
unwrapping e
.java.lang.Error
- if an Error
was encountered as an inner exception while unwrapping
e
.public static <E extends java.lang.Exception> E unwrapException(java.lang.Exception e, java.lang.Class<E> expectedExceptionType, ExceptionWrapper<E> wrapper)