Files
sdk/tests/lib/async/catch_errors.dart
T
2013-09-24 09:22:26 +00:00

20 lines
326 B
Dart

library catch_errors;
import 'dart:async';
Stream catchErrors(void body()) {
StreamController controller;
bool onError(e) {
controller.add(e);
return true;
}
void onListen() {
runZoned(body, onError: onError);
}
controller = new StreamController(onListen: onListen);
return controller.stream;
}