Class Throwables

java.lang.Object
com.pnfsoftware.jeb.util.base.Throwables

public class Throwables extends Object
Utility methods for throwables (errors, exceptions, runtime exceptions).
  • Constructor Details

    • Throwables

      public Throwables()
  • Method Details

    • formatStacktraceAlt

      public static String formatStacktraceAlt(Throwable t)
      This convenience method uses Throwables.ThrowableFormatter to format a stacktrace. Suppressed exceptions are not printed out. Exception tokens are safely escaped.
      Parameters:
      t -
      Returns:
    • formatStacktrace

      public static String formatStacktrace(Throwable t)
      Generate the standard formatting of a throwable as a multi-line, human-readable stacktrace.
      Parameters:
      t -
      Returns:
    • formatStacktraceShort

      public static String formatStacktraceShort(Throwable t)
      Format a throwable as a one-line, human-readable stacktrace.
      Parameters:
      t -
      Returns:
    • rethrowUnchecked

      public static void rethrowUnchecked(Throwable t)
      Rethrow a throwable if it is a RuntimeException, else wrap it in a RuntimeException and throw.
      Parameters:
      t -
    • getRootCause

      public static Throwable getRootCause(Throwable t)
      Get the innermost cause of a throwable.
      Parameters:
      t -
      Returns: