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

Unified Diff: sdk/lib/_internal/pub/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 | « no previous file | sdk/lib/_internal/pub_generated/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index 4daec903e75bca57081a61caad8008ec9e37dba0..09575d7bf8e9e54d733ade12dfd87f3ab9adfc47 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/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 | « no previous file | sdk/lib/_internal/pub_generated/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698