Class Exceptions


  • public class Exceptions
    extends Object
    Author:
    igor.vaynberg
    • Method Detail

      • getRootCause

        public Throwable getRootCause​(Throwable throwable)
        Gets root cause of the throwable
        Parameters:
        throwable -
        Returns:
        root cause
      • findCause

        public static <T extends Throwable> T findCause​(Throwable throwable,
                                                        Class<T> causeType)
        Looks for a cause of the specified type in throwable's chain
        Type Parameters:
        T -
        Parameters:
        throwable -
        causeType -
        Returns:
        matched Throwable in the chain or null if none
      • visit

        public static <T> T visit​(Throwable throwable,
                                  Exceptions.IThrowableVisitor<T> visitor)
        Visits the Throwable's chain
        Type Parameters:
        T -
        Parameters:
        throwable -
        visitor -
        Returns:
        result set on visitor or null if none