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

Unified Diff: pkg/scheduled_test/lib/scheduled_test.dart

Issue 154403006: Properly handle top-levled errors in scheduled_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: small change Created 6 years, 10 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 | « no previous file | pkg/scheduled_test/test/scheduled_test/unhandled_error_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/scheduled_test.dart
diff --git a/pkg/scheduled_test/lib/scheduled_test.dart b/pkg/scheduled_test/lib/scheduled_test.dart
index bf47adbc82eab5a11ef0a10473d1a04d7a5a2d69..671305440ac3c20453318ceb189dbade4cc32b17 100644
--- a/pkg/scheduled_test/lib/scheduled_test.dart
+++ b/pkg/scheduled_test/lib/scheduled_test.dart
@@ -238,17 +238,16 @@ void _test(String description, void body(), Function testFn) {
return currentSchedule.run(() {
if (_setUpFn != null) _setUpFn();
body();
+ }).catchError((error, stackTrace) {
+ if (error is ScheduleError) {
+ assert(error.schedule.errors.contains(error));
+ assert(error.schedule == currentSchedule);
+ unittest.registerException(error.schedule.errorString());
+ } else {
+ unittest.registerException(error, new Chain.forTrace(stackTrace));
+ }
}).then(completer.complete);
- }, onError: (e, chain) {
- if (e is ScheduleError) {
- assert(e.schedule.errors.contains(e));
- assert(e.schedule == currentSchedule);
- unittest.registerException(e.schedule.errorString());
- } else {
- unittest.registerException(e, chain);
- }
- completer.complete();
- });
+ }, onError: (error, chain) => currentSchedule.signalError(error, chain));
return completer.future;
});
« no previous file with comments | « no previous file | pkg/scheduled_test/test/scheduled_test/unhandled_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698