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

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

Issue 12210098: Fix a couple ScheduleError error messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | 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/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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698