public class ExceptionUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isFatal(Throwable throwable)
It is important never to catch all
Throwables. |
static void |
rethrow(Throwable throwable)
Designed to be used in conjunction with
isFatal(Throwable). |
public static boolean isFatal(Throwable throwable)
Throwables. Some like
InterruptedException should be rethrown. Based on
scala.util.control.NonFatal.throwable - to checkThrowable is a fatal errorpublic static void rethrow(Throwable throwable) throws Error, RuntimeException
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 checkError - the input throwable if it is an Error.RuntimeException - the input throwable if it is an RuntimeException
Otherwise wraps the throwable in a RuntimeException.