Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: sdk/lib/async/future.dart

Issue 2311923002: Don't propagate synchronous Future.wait errors immediately. (Closed)
Patch Set: Add test. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/async/future_test.dart » ('j') | tests/lib/async/future_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index c64e1c5e0316ca6baa5997c9eb131f6b768bb9bd..ff646e0e9e4cd716a1fa0f89c4f6c2233724f836 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -322,8 +322,11 @@ abstract class Future<T> {
// The error must have been thrown while iterating over the futures
// list, or while installing a callback handler on the future.
if (remaining == 0 || eagerError) {
- // Just complete the error immediately.
- result._completeError(e, st);
+ // Throw a new Future.error.
+ // Don't just complete the existing `_Future` since that would propagate
Lasse Reichstein Nielsen 2016/09/06 09:53:27 Drop this comment. If you used _asyncCompleteError
floitsch 2016/09/06 09:57:15 Done.
+ // the error too eagerly, not giving the callers time to install
+ // error handlers.
+ return new Future.error(e, st);
} else {
// Don't allocate a list for values, thus indicating that there was an
// error.
« no previous file with comments | « no previous file | tests/lib/async/future_test.dart » ('j') | tests/lib/async/future_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698