public class ExceptionUtils extends Object
Constructor and Description |
---|
ExceptionUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
rethrow(Throwable t)
Throws the given
Throwable in scenarios where the signatures do not allow you to
throw arbitrary Throwables. |
static void |
rethrow(Throwable t,
String parentMessage)
Throws the given
Throwable in scenarios where the signatures do not allow you to
throw arbitrary Throwables. |
static String |
stringifyException(Throwable e)
Makes a string representation of the exception's stack trace, or "(null)", if the
exception is null.
|
public static String stringifyException(Throwable e)
e
- The exception to stringify.public static void rethrow(Throwable t)
Throwable
in scenarios where the signatures do not allow you to
throw arbitrary Throwables. Errors and RuntimeExceptions are thrown directly, other exceptions
are packed into runtime exceptionst
- The throwable to be thrown.public static void rethrow(Throwable t, String parentMessage)
Throwable
in scenarios where the signatures do not allow you to
throw arbitrary Throwables. Errors and RuntimeExceptions are thrown directly, other exceptions
are packed into a parent RuntimeEception.t
- The throwable to be thrown.parentMessage
- The message for the parent RuntimeException, if one is needed.Copyright © 2015 The Apache Software Foundation. All rights reserved.