Package com.palantir.ptoss.util
Class Throwables
- java.lang.Object
 - 
- com.palantir.ptoss.util.Throwables
 
 
- 
public final class Throwables extends java.lang.ObjectA class of utility methods to make exception handling cleaner. 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K extends java.lang.Throwable>
voidthrowIfInstance(java.lang.Throwable t, java.lang.Class<K> clazz)if (t instanceof K) throw (K)t;static java.lang.RuntimeExceptionthrowUncheckedException(java.lang.Throwable ex)If Throwable is a RuntimeException or Error, rethrow it. 
 - 
 
- 
- 
Method Detail
- 
throwUncheckedException
public static java.lang.RuntimeException throwUncheckedException(java.lang.Throwable ex)
If Throwable is a RuntimeException or Error, rethrow it. If not, throw a new PalantirRuntimeException(ex) 
- 
throwIfInstance
public static <K extends java.lang.Throwable> void throwIfInstance(java.lang.Throwable t, java.lang.Class<K> clazz) throws K extends java.lang.Throwableif (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 java.lang.Throwable
 
 - 
 
 -