Package com.pnfsoftware.jeb.util.base
Class Throwables
java.lang.Object
com.pnfsoftware.jeb.util.base.Throwables
Utility methods for throwables (errors, exceptions, runtime exceptions).
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Generate the standard formatting of a throwable as a multi-line, human-readable stacktrace.static String
This convenience method usesThrowables.ThrowableFormatter
to format a stacktrace.static String
Format a throwable as a one-line, human-readable stacktrace.static Throwable
Get the innermost cause of a throwable.static void
Rethrow a throwable if it is aRuntimeException
, else wrap it in aRuntimeException
and throw.
-
Constructor Details
-
Throwables
public Throwables()
-
-
Method Details
-
formatStacktraceAlt
This convenience method usesThrowables.ThrowableFormatter
to format a stacktrace. Suppressed exceptions are not printed out. Exception tokens are safely escaped.- Parameters:
t
-- Returns:
-
formatStacktrace
Generate the standard formatting of a throwable as a multi-line, human-readable stacktrace.- Parameters:
t
-- Returns:
-
formatStacktraceShort
Format a throwable as a one-line, human-readable stacktrace.- Parameters:
t
-- Returns:
-
rethrowUnchecked
Rethrow a throwable if it is aRuntimeException
, else wrap it in aRuntimeException
and throw.- Parameters:
t
-
-
getRootCause
Get the innermost cause of a throwable.- Parameters:
t
-- Returns:
-