Package com.palantir.ptoss.util
Class Throwables
java.lang.Object
com.palantir.ptoss.util.Throwables
A class of utility methods to make exception handling cleaner.
- 
Method Summary
Modifier and TypeMethodDescriptionstatic <K extends Throwable>
voidthrowIfInstance(Throwable t, Class<K> clazz) if (t instanceof K) throw (K)t;static RuntimeExceptionIf Throwable is a RuntimeException or Error, rethrow it. 
- 
Method Details
- 
throwUncheckedException
If Throwable is a RuntimeException or Error, rethrow it. If not, throw a new PalantirRuntimeException(ex) - 
throwIfInstance
if (t instanceof K) throw (K)t;Note: The runtime type of the thrown exception will be the same as t even if clazz is a supertype of t.
- Throws:
 K extends Throwable
 
 -