Package org.carrot2.util
Class ExceptionUtils
java.lang.Object
org.carrot2.util.ExceptionUtils
public final class ExceptionUtils extends Object
A number of utility classes for working with
Throwables.-
Method Summary
Modifier and Type Method Description static StringcurrentStackTrace()Returns the current stack trace of the calling thread.static <T extends Throwable>
TwrapAs(Class<T> clazz, Throwable t)Iftif an instance ofclazz, thentis returned.static RuntimeExceptionwrapAsRuntimeException(Throwable t)CallswrapAs(Class, Throwable)with the first parameter set toRuntimeException.
-
Method Details
-
wrapAs
Iftif an instance ofclazz, thentis returned. Otherwise an instance ofclazzis created using a single-parameter constructor acceptingtand the wrapper exception instance is returned. If no matching constructor can be found, aRuntimeExceptionis returned.- Parameters:
clazz- The exception class to return (or wrap)t.t- Throwable instance to wrap.
-
wrapAsRuntimeException
CallswrapAs(Class, Throwable)with the first parameter set toRuntimeException. -
currentStackTrace
Returns the current stack trace of the calling thread.
-