Class ThrowingEx


  • public final class ThrowingEx
    extends Object
    Basic functional interfaces which throw exception, along with static helper methods for calling them. Contains most of the functionality of Durian's Throwing and Errors classes, but stripped down and renamed to avoid any confusion.
    • Method Detail

      • run

        public static void run​(ThrowingEx.Runnable runnable)
        Runs the given runnable, rethrowing any exceptions as runtime exceptions.
      • get

        public static <T> T get​(ThrowingEx.Supplier<T> supplier)
        Gets the given value, rethrowing any exceptions as runtime exceptions.
      • unwrapCause

        public static RuntimeException unwrapCause​(Throwable e)
        Utility method for rethrowing an exception's cause with as few wrappers as possible.
        
         try {
             doSomething();
         } catch (Throwable e) {
             throw unwrapCause(e);
         }