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

Side by Side Diff: tests/lib/async/catch_errors.dart

Issue 16801008: catchErrors and waitForCompletion now based on runZonedExperimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Some tests. Created 7 years, 6 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
(Empty)
1 library catch_errors;
2
3 import 'dart:async';
4
5 Stream catchErrors(void body()) {
6 StreamController controller;
7
8 bool onError(e) {
9 controller.add(e);
10 return true;
11 }
12
13 void onDone() {
14 controller.close();
15 }
16
17 void onListen() {
18 runZonedExperimental(body, onError: onError, onDone: onDone);
19 }
20
21 controller = new StreamController(onListen: onListen);
22 return controller.stream;
23 }
24
25 Future waitForCompletion(void body()) {
26 Completer completer = new Completer.sync();
27 runZonedExperimental(body, onDone: completer.complete);
28 return completer.future;
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698