code: public static Runnable runnable(CheckedRunnable runnable, Consumer<Throwable> handler) {
          return () -> {
              try {
                  runnable.run();
              }
              catch (Throwable e) {
                  handler.accept(e);
  
                  throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
              }
          };
      }
docs: Wrap a {@link CheckedRunnable} in a {@link Runnable} with a custom handler for checked exceptions.
  <p>
  Example:
  <code><pre>
  new Thread(Unchecked.runnable(
  () -> {
  throw new Exception("Cannot run this thread");
  },
  e -> {
  throw new IllegalStateException(e);
  }
  )).start();
  </pre></code>