java.lang.Object
ushiosan.jvm_utilities.error.Errors

public final class Errors extends Object
  • Method Details

    • launch

      public static <T extends Throwable> void launch(@NotNull @NotNull Class<T> clazz, Object... args) throws T
      Launch specific exception.

      Not recommended for use as manual instance substitution, as it can be very unsafe when invoking constructors.

      Type Parameters:
      T - exception type
      Parameters:
      clazz - the exception to invoke
      args - exception arguments
      Throws:
      RuntimeException - error if the instance could not be created
      T - selected error generation
    • getRootCause

      @NotNull public static @NotNull Throwable getRootCause(@NotNull @NotNull Throwable base)
      Returns the base cause of the exception. This method tries to find the main or root cause of the exception, it returns the same object if the exception is already the main cause.
      Parameters:
      base - base exception to analyze
      Returns:
      returns the root cause of exception
    • toString

      @NotNull public static @NotNull String toString(@NotNull @NotNull Throwable error, boolean simplify)
      Returns the exception stack trace in text format.
      Parameters:
      error - The exception to analyze
      simplify - if state is true only the main cause will be taken into account or all the error will be taken into account if the state is false
      Returns:
      Returns the exception stack trace string