public final class Exceptions extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addCause(Throwable
Adds a
Throwable to a causality-chain of Throwables, as an additional cause (if it does not already appear in the chain among the causes).
|
static Throwable |
getFinalCause(Throwable
Get the
Throwable at the end of the causality-chain for a particular
Throwable
|
static RuntimeException |
propagate(Throwable
|
static void |
throwIfFatal(Throwable
Throws a particular
Throwable only if it belongs to a set of "fatal" error varieties.
|
public static RuntimeExceptionpropagate(Throwable t)
propagate itself throws an exception or error, this is a sort of phantom return value;
propagate does not actually return anything
public static void throwIfFatal(Throwablet)
Throwable only if it belongs to a set of "fatal" error varieties. These varieties are as follows:
OnErrorNotImplementedExceptionOnErrorFailedExceptionStackOverflowErrorVirtualMachineErrorThreadDeathLinkageErroronError methods, but only if the errors are not so catastrophic that such a call would be futile, in which case you simply want to rethrow the error.
t - the
Throwable to test and perhaps throw
public static void addCause(Throwablee, Throwable cause)
Throwable to a causality-chain of Throwables, as an additional cause (if it does not already appear in the chain among the causes).
e - the
Throwable at the head of the causality chain
cause - the
Throwable you want to add as a cause of the chain
public static ThrowablegetFinalCause(Throwable e)
Throwable at the end of the causality-chain for a particular
Throwable
e - the
Throwable whose final cause you are curious about
Throwable in the causality-chain of
e (or a "Stack too deep to get final cause"
RuntimeException if the chain is too long to traverse)