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 StringGenerate the standard formatting of a throwable as a multi-line, human-readable stacktrace.static StringThis convenience method usesThrowables.ThrowableFormatterto format a stacktrace.static StringFormat a throwable as a one-line, human-readable stacktrace.static ThrowableGet the innermost cause of a throwable.static voidRethrow a throwable if it is aRuntimeException, else wrap it in aRuntimeExceptionand throw.
-
Constructor Details
-
Throwables
public Throwables()
-
-
Method Details
-
formatStacktraceAlt
This convenience method usesThrowables.ThrowableFormatterto 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 aRuntimeExceptionand throw.- Parameters:
t-
-
getRootCause
Get the innermost cause of a throwable.- Parameters:
t-- Returns:
-