Package org.carrot2.util
Class ExceptionUtils
- java.lang.Object
-
- org.carrot2.util.ExceptionUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
currentStackTrace()
Returns the current stack trace of the calling thread.static <T extends Throwable>
TwrapAs(Class<T> clazz, Throwable t)
Ift
if an instance ofclazz
, thent
is returned.static RuntimeException
wrapAsRuntimeException(Throwable t)
CallswrapAs(Class, Throwable)
with the first parameter set toRuntimeException
.
-
-
-
Method Detail
-
wrapAs
public static <T extends Throwable> T wrapAs(Class<T> clazz, Throwable t)
Ift
if an instance ofclazz
, thent
is returned. Otherwise an instance ofclazz
is created using a single-parameter constructor acceptingt
and the wrapper exception instance is returned. If no matching constructor can be found, aRuntimeException
is returned.- Parameters:
clazz
- The exception class to return (or wrap)t
.t
- Throwable instance to wrap.
-
wrapAsRuntimeException
public static RuntimeException wrapAsRuntimeException(Throwable t)
CallswrapAs(Class, Throwable)
with the first parameter set toRuntimeException
.
-
currentStackTrace
public static String currentStackTrace()
Returns the current stack trace of the calling thread.
-
-