Class ExceptionUtils

java.lang.Object
com.linkedin.venice.utils.ExceptionUtils

public class ExceptionUtils extends Object
Static utility functions to deal with exceptions. Copied from here: https://github.com/voldemort/voldemort/blob/ea37ef67fa7724180608510c6d4237167b78dd63/src/java/voldemort/utils/ExceptionUtils.java
  • Constructor Details

    • ExceptionUtils

      public ExceptionUtils()
  • Method Details

    • recursiveClassEquals

      public static boolean recursiveClassEquals(Throwable throwableToInspect, Class... throwableClassesToLookFor)
      Inspects a given Throwable as well as its nested causes, in order to look for a specific set of exception classes. The function also detects if the throwable to inspect is a subclass of one of the classes you look for, but not the other way around (i.e.: if you're looking for the subclass but the throwableToInspect is the parent class, then this function returns false).
      Returns:
      true if the throwableToInspect corresponds to or is caused by any of the throwableClassesToLookFor
    • recursiveMessageContains

      public static boolean recursiveMessageContains(Throwable throwableToInspect, String message)
      Inspects a given Throwable as well as its nested causes, in order to look for a specific message.
      Returns:
      true if the throwableToInspect contains the message parameter
    • stackTraceToString

      public static String stackTraceToString(Throwable throwable)
      Returns:
      a String representation of the provided throwable's stacktrace.
    • threadToThrowableToString

      public static String threadToThrowableToString(Thread thread)
    • logClassLoaderContent

      public static void logClassLoaderContent(String packageName)
    • compactExceptionDescription

      public static String compactExceptionDescription(Throwable t)
    • compactExceptionDescription

      public static String compactExceptionDescription(Throwable t, String originatingFunctionName)