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

Side by Side Diff: sdk/lib/async/stream.dart

Issue 50453005: Propagate stack traces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 // ------------------------------------------------------------------- 7 // -------------------------------------------------------------------
8 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 * 60 *
61 * When the future completes, the stream will fire one event, either 61 * When the future completes, the stream will fire one event, either
62 * data or error, and then close with a done-event. 62 * data or error, and then close with a done-event.
63 */ 63 */
64 factory Stream.fromFuture(Future<T> future) { 64 factory Stream.fromFuture(Future<T> future) {
65 StreamController<T> controller = new StreamController<T>(sync: true); 65 StreamController<T> controller = new StreamController<T>(sync: true);
66 future.then((value) { 66 future.then((value) {
67 controller.add(value); 67 controller.add(value);
68 controller.close(); 68 controller.close();
69 }, 69 },
70 onError: (error) { 70 onError: (error, stackTrace) {
71 controller.addError(error); 71 controller.addError(error, stackTrace);
72 controller.close(); 72 controller.close();
73 }); 73 });
74 return controller.stream; 74 return controller.stream;
75 } 75 }
76 76
77 /** 77 /**
78 * Creates a single-subscription stream that gets its data from [data]. 78 * Creates a single-subscription stream that gets its data from [data].
79 * 79 *
80 * If iterating [data] throws an error, the stream ends immediately with 80 * If iterating [data] throws an error, the stream ends immediately with
81 * that error. No done event will be sent (iteration is not complete), but no 81 * that error. No done event will be sent (iteration is not complete), but no
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 * 1223 *
1224 * If you need to stop listening for values before the stream iterator is 1224 * If you need to stop listening for values before the stream iterator is
1225 * automatically closed, you must call [cancel] to ensure that the stream 1225 * automatically closed, you must call [cancel] to ensure that the stream
1226 * is properly closed. 1226 * is properly closed.
1227 * 1227 *
1228 * Returns a future if the cancel-operation is not completed synchronously. 1228 * Returns a future if the cancel-operation is not completed synchronously.
1229 * Otherwise returns `null`. 1229 * Otherwise returns `null`.
1230 */ 1230 */
1231 Future cancel(); 1231 Future cancel();
1232 } 1232 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698