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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/utils.dart

Issue 791953007: Ensure that pub doesn't double-complete its captureErrors future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub_generated/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/utils.dart b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
index 3804e134d6fedb8d45760e41b358fddfda1c49dd..d03db2a4d724b9b5839f5c12debb3c46f52aebd3 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
@@ -104,12 +104,14 @@ Future captureErrors(Future callback(), {bool captureStackChains: false}) {
} else {
stackTrace = new Chain([]);
}
- completer.completeError(e, stackTrace);
+ if (!completer.isCompleted) completer.completeError(e, stackTrace);
});
};
if (captureStackChains) {
- Chain.capture(wrappedCallback, onError: completer.completeError);
+ Chain.capture(wrappedCallback, onError: (error, stackTrace) {
+ if (!completer.isCompleted) completer.completeError(error, stackTrace);
+ });
} else {
runZoned(wrappedCallback, onError: (e, stackTrace) {
if (stackTrace == null) {
@@ -117,7 +119,7 @@ Future captureErrors(Future callback(), {bool captureStackChains: false}) {
} else {
stackTrace = new Chain([new Trace.from(stackTrace)]);
}
- completer.completeError(e, stackTrace);
+ if (!completer.isCompleted) completer.completeError(e, stackTrace);
});
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698