Class Throwables


  • public final class Throwables
    extends Object
    • Method Detail

      • getCauseOfType

        @Nullable
        public static <T extends Throwable> T getCauseOfType​(Throwable t,
                                                             Class<T> searchFor)
        searches for a throwable in the cause chain that is of same type as {@param searchFor}. The class of returned throwable will either be same as {@param searchFor} or a sub-class of {@param searchFor}.
        Parameters:
        t - - the throwable in which to search
        searchFor - - Class of throwable to search for
        Returns:
        null if not found otherwise the cause exception that is of same type as searchFor