public class ExceptionWrapper extends Object
Provides a static function to wrap a throwable in a RuntimeException if necessary.
This can be used instead of declaring checked exceptions, like this:
try {
f = open("/dev/null", "w");
} catch (Throwable throwable) {
throw ExceptionWrapper.wrap(throwable);
}
Modifier and Type | Method and Description |
---|---|
static RuntimeException |
wrap(Throwable throwable)
Returns the given throwable as a
RuntimeException wrapping it in a new
RuntimeException if necessary. |
public static RuntimeException wrap(Throwable throwable)
RuntimeException
wrapping it in a new
RuntimeException
if necessary.throwable
- The throwable to wrapCopyright © 2013. All Rights Reserved.