code: private static <X extends Exception> void wrapAndThrowExceptionOrError(
        Throwable cause, Class<X> exceptionClass) throws X {
      if (cause instanceof Error) {
        throw new ExecutionError((Error) cause);
      }
      if (cause instanceof RuntimeException) {
        throw new UncheckedExecutionException(cause);
      }
      throw newWithCause(exceptionClass, cause);
    }
docs: TODO(cpovirk): change parameter order to match other helper methods (Class, Throwable)?