public final class Throwables
extends java.lang.Object
Throwable
.Modifier | Constructor and Description |
---|---|
private |
Throwables() |
Modifier and Type | Method and Description |
---|---|
private static <T extends java.lang.Throwable> |
rethrow(java.lang.Throwable e) |
static java.lang.Exception |
rethrowAsException(java.lang.Throwable e)
Rethrows the given
Throwable , allowing the caller to
declare that it throws Exception . |
public static java.lang.Exception rethrowAsException(java.lang.Throwable e) throws java.lang.Exception
Throwable
, allowing the caller to
declare that it throws Exception
. This is useful when
your callers have nothing reasonable they can do when a
Throwable
is thrown. This is declared to return Exception
so it can be used in a throw
clause:
try { doSomething(); } catch (Throwable e} { throw Throwables.rethrowAsException(e); } doSomethingLater();
e
- exception to rethrowjava.lang.Exception
private static <T extends java.lang.Throwable> void rethrow(java.lang.Throwable e) throws T extends java.lang.Throwable
T extends java.lang.Throwable