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 0f97161a58a4407f42ea1a8d80f323a117a0498e..458e2c4e685f10182e895e9fcd404d124651a0aa 100644 |
| --- a/pkg/scheduled_test/lib/src/schedule_error.dart |
| +++ b/pkg/scheduled_test/lib/src/schedule_error.dart |
| @@ -19,6 +19,10 @@ 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. |
| + bool _scheduleWasDone; |
| + |
| /// Creates a new [ScheduleError] wrapping [error]. The metadata in |
| /// [AsyncError]s and [ScheduleError]s will be preserved. |
| factory ScheduleError.from(Schedule schedule, error, {stackTrace, |
| @@ -40,7 +44,9 @@ class ScheduleError extends AsyncError { |
| } |
| ScheduleError(this.schedule, error, stackTrace, AsyncError cause, this.task) |
| - : super.withCause(error, stackTrace, cause); |
| + : super.withCause(error, stackTrace, cause) { |
|
Bob Nystrom
2013/02/11 22:30:19
Indent another two.
|
| + _scheduleWasDone = schedule.done; |
|
Bob Nystrom
2013/02/11 22:30:19
I'd prefer this to be final and in the initializat
|
| + } |
| String toString() { |
| var result = new StringBuffer(); |
| @@ -61,10 +67,10 @@ class ScheduleError extends AsyncError { |
| if (task != null) { |
| result.add('Error detected during task in queue "${task.queue}":\n'); |
| result.add(task.generateTree()); |
| - } else if (schedule.done) { |
| + } else if (_scheduleWasDone) { |
| result.add('Error detected after all tasks in the queue had finished.'); |
| } else { |
| - result.add('Error detected before the schedule started running'); |
| + result.add('Error detected before the schedule started running.'); |
| } |
| return result.toString(); |