java.lang.Object
ushiosan.jvm_utilities.error.Errors
Class with helper methods for errors and objects of the same type
-
Method Summary
Modifier and TypeMethodDescriptiongetRootCause(@NotNull Throwable base) Returns the base cause of the exception.static <T extends Throwable>
voidLaunch specific exception.Returns the exception stack trace in text format.
-
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 invokeargs- exception arguments- Throws:
RuntimeException- error if the instance could not be createdT- selected error generation
-
getRootCause
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 analyzesimplify- if state istrueonly the main cause will be taken into account or all the error will be taken into account if the state isfalse- Returns:
- Returns the exception stack trace string
-