Class ExceptionUtils

java.lang.Object
com.polarion.core.util.exceptions.ExceptionUtils

public class ExceptionUtils extends Object
Author:
Michal Dobisek, Polarion Software
  • Method Details

    • getCausesString

      public static String getCausesString(Throwable t)
      Traverses the exception stack and creates the report from their causes, in form:
       ExceptionType: message
       caused by: ExceptionType: message
       caused by: ExceptionType: message
       ...
       
    • handleUserFriendlyExceptions

      public static String handleUserFriendlyExceptions(Throwable t)
    • getMessage

      public static String getMessage(Throwable t)
    • getCauseMessage

      public static String getCauseMessage(Throwable t)
    • findException

      @Nullable public static Throwable findException(@Nullable Throwable throwable, @NotNull Class<?> type)
      This method returns the same object as findExceptionByType(Throwable, Class), but it may be more useful if you are looking for an exception implementing an interface, but you want to make use of the Throwable class (without casting).
    • findExceptionByType

      @Nullable public static <T> T findExceptionByType(@Nullable Throwable throwable, @NotNull Class<T> type)
      Returns the first Throwable class that matches the specified class (subclasses match) in the chain of exception causes, starting from the given Throwable.
      Since:
      3.22.1
    • findInvocationTargetException

      @Nullable public static InvocationTargetException findInvocationTargetException(@Nullable Throwable throwable)
    • findDeapestCause

      public static Throwable findDeapestCause(Throwable t)
    • getCause

      public static Throwable getCause(Throwable t)
    • getStackTrace

      public static String getStackTrace(Throwable t)