Chromium Code Reviews| Index: pkg/scheduled_test/lib/src/schedule_error.dart |
| diff --git a/pkg/scheduled_test/lib/src/schedule_error.dart b/pkg/scheduled_test/lib/src/schedule_error.dart |
| index ce1f344946493dfeea69afede3dc462126b6f815..544a111db8ad88b72e0bb29a780d579d81befa71 100644 |
| --- a/pkg/scheduled_test/lib/src/schedule_error.dart |
| +++ b/pkg/scheduled_test/lib/src/schedule_error.dart |
| @@ -19,9 +19,8 @@ class ScheduleError extends AsyncError { |
| /// there was no such task. |
| final Task task; |
| - /// Whether the schedule was finished executing at the time the error was |
| - /// detected. |
| - final bool _scheduleWasDone; |
| + /// The state of the schedule at the time the error was detected. |
| + final ScheduleState _stateWhenDetected; |
| /// Creates a new [ScheduleError] wrapping [error]. The metadata in |
| /// [AsyncError]s and [ScheduleError]s will be preserved. |
| @@ -47,7 +46,7 @@ class ScheduleError extends AsyncError { |
| this.task) |
| : super.withCause(error, stackTrace, cause), |
| this.schedule = schedule, |
| - this._scheduleWasDone = schedule.done; |
| + this._stateWhenDetected = schedule.state; |
| String toString() { |
| var result = new StringBuffer(); |
| @@ -68,9 +67,9 @@ class ScheduleError extends AsyncError { |
| if (task != null) { |
| result.add('Error detected during task in queue "${task.queue}":\n'); |
| result.add(task.generateTree()); |
| - } else if (_scheduleWasDone) { |
| + } else if (_stateWhenDetected == ScheduleState.DONE) { |
| result.add('Error detected after all tasks in the queue had finished.'); |
| - } else { |
| + } else { // _stateWhenDetected == ScheduleState.SET_UP |
|
Bob Nystrom
2013/02/12 00:34:17
How about doing an explicit else if here for this
nweiz
2013/02/12 01:15:57
I'm really paranoid about getting into an unexpect
|
| result.add('Error detected before the schedule started running.'); |
| } |