public final class ExceptionHelper extends Object
| Constructor and Description |
|---|
ExceptionHelper() |
| Modifier and Type | Method and Description |
|---|---|
static RuntimeException |
unchecked(Throwable e)
Rethrows a checked exception as unchecked exception.
|
static <T> T |
wrap(Callable<T> exec)
Tries to call the callable and return the result.
|
public static RuntimeException unchecked(Throwable e)
RuntimeException.
This method never returns. Nevertheless, it specifies a return type so it can be invoked as
throw unchecked(e) in contexts where an exception type is syntactically required
(e.g. when the enclosing method is non-void).
e - Throwable to be made unchecked.public static <T> T wrap(Callable<T> exec)
T - Type of return parameter.exec - Callable to execute.