public class ExceptionUtil extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isFatal(Throwable throwable)
It is important never to catch all
Throwable s. |
static void |
rethrow(Throwable throwable)
Designed to be used in conjunction with
isFatal(Throwable) . |
public static boolean isFatal(Throwable throwable)
Throwable
s. Some like
InterruptedException
should be rethrown. Based on
scala.util.control.NonFatal.throwable
- to checkThrowable
is a fatal errorpublic static void rethrow(Throwable throwable)
isFatal(Throwable)
.
This method should be used with care.
The input throwable is thrown if it is an Error
or a RuntimeException
.
Otherwise, the method wraps the throwable in a RuntimeException and rethrows that.
throwable
- to check