public final class Throwables extends Object
Throwable.| Modifier and Type | Method and Description |
|---|---|
static Exception |
rethrowAsException(Throwable e)
Rethrows the given
Throwable, allowing the caller to
declare that it throws Exception. |
public static Exception rethrowAsException(Throwable e) throws 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 rethrowExceptionCopyright © 2002–2017 JUnit. All rights reserved.