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

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

Issue 12512005: Display which nested tasks are running when an error occurs in a scheduled test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/scheduled_test/lib/src/schedule.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/src/task.dart
diff --git a/pkg/scheduled_test/lib/src/task.dart b/pkg/scheduled_test/lib/src/task.dart
index 8a34f10228581a66f3fdddea9c8ac5cb641e6710..2ce3905517a2503d4766da0133bfb7ec15fb3524 100644
--- a/pkg/scheduled_test/lib/src/task.dart
+++ b/pkg/scheduled_test/lib/src/task.dart
@@ -90,8 +90,11 @@ class Task {
// catchError makes sure any error thrown by fn isn't top-leveled by virtue
// of being passed to the result future.
- result.whenComplete(() {
- _state = TaskState.DONE;
+ result.then((_) {
+ _state = TaskState.SUCCESS;
+ }).catchError((e) {
+ _state = TaskState.ERROR;
+ throw e;
}).catchError((_) {});
}
@@ -125,12 +128,19 @@ class TaskState {
/// The task is currently running.
static const RUNNING = const TaskState._("RUNNING");
- /// The task has finished running, either successfully or with an error.
- static const DONE = const TaskState._("DONE");
+ /// The task has finished running successfully.
+ static const SUCCESS = const TaskState._("SUCCESS");
+
+ /// The task has finished running with an error.
+ static const ERROR = const TaskState._("ERROR");
/// The name of the state.
final String name;
+ /// Whether the state indicates that the task has finished running. This is
+ /// true for both the [SUCCESS] and [ERROR] states.
+ bool get isDone => this == SUCCESS || this == ERROR;
+
const TaskState._(this.name);
String toString() => name;
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698