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

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

Issue 25094002: Adapt streams for additional stackTrace argument. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove types in closures. Created 7 years, 2 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/safe_http_server.dart ('k') | sdk/lib/async/broadcast_stream_controller.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 55529ea872e277fc537dd073da605582207356dd..6d411fe237688ff834a4e154aa7ca0727908232c 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -303,15 +303,15 @@ Future<Stream> validateStream(Stream stream) {
// We got a value, so the stream is valid.
if (!completer.isCompleted) completer.complete(controller.stream);
controller.add(value);
- }, onError: (error) {
+ }, onError: (error, [stackTrace]) {
// If the error came after values, it's OK.
if (completer.isCompleted) {
- controller.addError(error);
+ controller.addError(error, stackTrace);
return;
}
// Otherwise, the error came first and the stream is invalid.
- completer.completeError(error);
+ completer.completeError(error, stackTrace);
// We don't be returning the stream at all in this case, so unsubscribe
// and swallow the error.
@@ -334,8 +334,8 @@ Future streamFirst(Stream stream) {
subscription = stream.listen((value) {
subscription.cancel();
completer.complete(value);
- }, onError: (e) {
- completer.completeError(e);
+ }, onError: (e, [stackTrace]) {
+ completer.completeError(e, stackTrace);
}, onDone: () {
completer.completeError(new StateError("No elements"));
}, cancelOnError: true);
@@ -364,9 +364,9 @@ Pair<Stream, Stream> tee(Stream stream) {
stream.listen((value) {
controller1.add(value);
controller2.add(value);
- }, onError: (error) {
- controller1.addError(error);
- controller2.addError(error);
+ }, onError: (error, [stackTrace]) {
+ controller1.addError(error, stackTrace);
+ controller2.addError(error, stackTrace);
}, onDone: () {
controller1.close();
controller2.close();
@@ -381,11 +381,10 @@ Stream mergeStreams(Stream stream1, Stream stream2) {
var controller = new StreamController(sync: true);
for (var stream in [stream1, stream2]) {
- stream.listen((value) {
- controller.add(value);
- }, onError: (error) {
- controller.addError(error);
- }, onDone: () {
+ stream.listen(
+ controller.add,
+ onError: controller.addError,
+ onDone: () {
doneCount++;
if (doneCount == 2) controller.close();
});
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/safe_http_server.dart ('k') | sdk/lib/async/broadcast_stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698