@@ -147,6 +147,7 @@ public static <T> Promise<List<T>> all(boolean cancelRemaining, List<CompletionS
147147 * if all promises completed exceptionally, then resulting promise is resolved faulty as well.
148148 * <p>The resolved result of this promise contains a value of the first resolved result of the {@link CompletionStage}-s passed as an
149149 * argument.
150+ * <p>When <code>promises</code> argument is empty returns faulty-resolved {@link Promise} with {@link NoSuchElementException} fault.
150151 * <p>When resulting promise is resolved successfully, all remaining incomplete {@link CompletionStage}-s are cancelled.
151152 *
152153 * @param <T>
@@ -169,6 +170,7 @@ public static <T> Promise<T> any(List<CompletionStage<? extends T>> promises) {
169170 * if all promises completed exceptionally, then resulting promise is resolved faulty as well.
170171 * <p>The resolved result of this promise contains a value of the first resolved result of the {@link CompletionStage}-s passed as an
171172 * argument.
173+ * <p>When <code>promises</code> argument is empty returns faulty-resolved {@link Promise} with {@link NoSuchElementException} fault.
172174 * <p>When resulting promise is resolved successfully <em>and</em> <code>cancelRemaining</code> parameter is <code>true</code>,
173175 * all remaining incomplete {@link CompletionStage}-s are cancelled.
174176 *
@@ -211,7 +213,10 @@ public static <T> Promise<T> any(boolean cancelRemaining, List<CompletionStage<?
211213 * (unlike non-Strict variant, where exceptions are ignored if result is available at all).
212214 * <p>The resolved result of this promise contains a value of the first resolved result of the {@link CompletionStage}-s passed as an
213215 * argument.
216+ * <p>When <code>promises</code> argument is empty returns faulty-resolved {@link Promise} with {@link NoSuchElementException} fault.
214217 * <p>When resulting promise is resolved either successfully or faulty, all remaining incomplete {@link CompletionStage}-s are cancelled.
218+ * <p>Unlike other methods to combine promises (any, all, atLeast, atLeastStrict), the {@link Promise} returns from this method reports
219+ * exact exception. All other methods wrap it to {@link MultitargetException}.
215220 * @param <T>
216221 * a common supertype of the resulting values
217222 * @param promises
@@ -234,8 +239,11 @@ public static <T> Promise<T> anyStrict(List<CompletionStage<? extends T>> promis
234239 * (unlike non-Strict variant, where exceptions are ignored if result is available at all).
235240 * <p>The resolved result of this promise contains a value of the first resolved result of the {@link CompletionStage}-s passed as an
236241 * argument.
242+ * <p>When <code>promises</code> argument is empty returns faulty-resolved {@link Promise} with {@link NoSuchElementException} fault.
237243 * <p>When resulting promise is resolved either successfully or faulty <em>and</em> <code>cancelRemaining</code> parameter is <code>true</code>,
238244 * all remaining incomplete {@link CompletionStage}-s are cancelled.
245+ * <p>Unlike other methods to combine promises (any, all, atLeast, atLeastStrict), the {@link Promise} returns from this method reports
246+ * exact exception. All other methods wrap it to {@link MultitargetException}.
239247 * @param <T>
240248 * a common supertype of the resulting values
241249 * @param cancelRemaining
@@ -428,7 +436,7 @@ public static <T> Promise<List<T>> atLeast(int minResultsCount, int maxErrorsCou
428436 } else if (minResultsCount == 0 ) {
429437 return success (Collections .emptyList ());
430438 } else if (size == 1 ) {
431- return transform (promises .get (0 ), Collections ::singletonList , Function . identity () );
439+ return transform (promises .get (0 ), Collections ::singletonList , Promises :: wrapMultitargetException );
432440 } else {
433441 return new AggregatingPromise <>(minResultsCount , maxErrorsCount , cancelRemaining , promises );
434442 }
0 commit comments