Class ExceptionHelper


  • public class ExceptionHelper
    extends Object
    Helper methods for exception handling
    • Constructor Detail

      • ExceptionHelper

        public ExceptionHelper()
    • Method Detail

      • findCause

        public static <T extends Throwable> T findCause​(Throwable throwable,
                                                        Class<T> type)
        Finds an instance of the specified throwable type within the stack trace of the given error
      • findCause

        public static Throwable findCause​(Throwable throwable,
                                          String typeName)
        Finds an instance of the specified throwable type within the stack trace of the given error
      • throwWithType

        public static <T extends RuntimeException> void throwWithType​(Throwable th,
                                                                      Class<T> type)
        Throw the specified exception if found in the cause chain from th.