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

Side by Side Diff: pkg/scheduled_test/lib/src/utils.dart

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
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 library utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:stack_trace/stack_trace.dart'; 9 import 'package:stack_trace/stack_trace.dart';
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } catch (_, thrownStackTrace) { 100 } catch (_, thrownStackTrace) {
101 stackTrace = thrownStackTrace; 101 stackTrace = thrownStackTrace;
102 } 102 }
103 103
104 var completer = new Completer(); 104 var completer = new Completer();
105 var subscription; 105 var subscription;
106 subscription = stream.listen((value) { 106 subscription = stream.listen((value) {
107 subscription.cancel(); 107 subscription.cancel();
108 completer.complete(value); 108 completer.complete(value);
109 }, onError: (e) { 109 }, onError: (e) {
110 completer.completeError(e.error, e.stackTrace); 110 completer.completeError(e);
111 }, onDone: () { 111 }, onDone: () {
112 completer.completeError(new StateError("No elements"), stackTrace); 112 completer.completeError(new StateError("No elements"), stackTrace);
113 }, cancelOnError: true); 113 }, cancelOnError: true);
114 return completer.future; 114 return completer.future;
115 } 115 }
116 116
117 /// A function that can be called to cancel a [Stream] and send a done message. 117 /// A function that can be called to cancel a [Stream] and send a done message.
118 typedef void StreamCanceller(); 118 typedef void StreamCanceller();
119 119
120 // TODO(nweiz): use a StreamSubscription when issue 9026 is fixed. 120 // TODO(nweiz): use a StreamSubscription when issue 9026 is fixed.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 /// Returns a string representation of [trace] that has the core and test frames 188 /// Returns a string representation of [trace] that has the core and test frames
189 /// folded together. 189 /// folded together.
190 String terseTraceString(StackTrace trace) { 190 String terseTraceString(StackTrace trace) {
191 return new Trace.from(trace).terse.foldFrames((frame) { 191 return new Trace.from(trace).terse.foldFrames((frame) {
192 return frame.package == 'scheduled_test' || frame.package == 'unittest' || 192 return frame.package == 'scheduled_test' || frame.package == 'unittest' ||
193 frame.isCore; 193 frame.isCore;
194 }).toString().trim(); 194 }).toString().trim();
195 } 195 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/src/substitute_future.dart ('k') | pkg/scheduled_test/lib/src/value_future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698