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

Unified Diff: pkg/barback/lib/src/stream_replayer.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 | « pkg/barback/lib/src/package_graph.dart ('k') | pkg/barback/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/stream_replayer.dart
diff --git a/pkg/barback/lib/src/stream_replayer.dart b/pkg/barback/lib/src/stream_replayer.dart
index 177e13d609f6cc9bb0fafa00ec85ae8d4a8007b6..bb0400749308b1bb6cd4f601b602f0df40ff6d1d 100644
--- a/pkg/barback/lib/src/stream_replayer.dart
+++ b/pkg/barback/lib/src/stream_replayer.dart
@@ -23,7 +23,7 @@ class StreamReplayer<T> {
///
/// Each element is a [Either] that's either a value or an error sent through
/// the stream.
- final _buffer = new Queue<Either<T, dynamic>>();
+ final _buffer = new Queue<Either<T, Pair<dynamic, StackTrace>>>();
/// The controllers that are listening for future events from [_stream].
final _controllers = new Set<StreamController<T>>();
@@ -34,10 +34,11 @@ class StreamReplayer<T> {
for (var controller in _controllers) {
controller.add(data);
}
- }, onError: (error) {
- _buffer.add(new Either<T, dynamic>.withSecond(error));
+ }, onError: (error, [stackTrace]) {
+ _buffer.add(new Either<T, Pair<dynamic, StackTrace>>.withSecond(
+ new Pair<dynamic, StackTrace>(error, stackTrace)));
for (var controller in _controllers) {
- controller.addError(error);
+ controller.addError(error, stackTrace);
}
}, onDone: () {
_isClosed = true;
@@ -55,7 +56,9 @@ class StreamReplayer<T> {
Stream<T> getReplay() {
var controller = new StreamController<T>();
for (var eventOrError in _buffer) {
- eventOrError.match(controller.add, controller.addError);
+ eventOrError.match(controller.add, (pair) {
+ controller.addError(pair.first, pair.second);
+ });
}
if (_isClosed) {
controller.close();
« no previous file with comments | « pkg/barback/lib/src/package_graph.dart ('k') | pkg/barback/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698