java.lang.Object
dk.cloudcreate.essentials.shared.Exceptions

public final class Exceptions extends Object
  • Constructor Details

    • Exceptions

      public Exceptions()
  • Method Details

    • sneakyThrow

      public static <T extends Throwable, R> R sneakyThrow(Throwable t) throws T
      Allows us to sneaky throw a checked exception without having to wrap it
      Use with caution
      Throws:
      T extends Throwable
    • getStackTrace

      public static String getStackTrace(Throwable throwable)
      Get the stacktrace of the throwable as a String
      Parameters:
      throwable - the exception
      Returns:
      the throwable's full stacktrace
    • getRootCause

      public static Throwable getRootCause(Throwable exception)
      Get the root cause (top most parent) of an Exception.
      Parameters:
      exception - the exception we want the root cause of
      Returns:
      the root cause of the exception - will never be null