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 179419b5ae6c4362b7b64308cb3b664e93c1eade..c628bfba5a06b9f68cf316dd4a6945f37a0a8815 100644 |
| --- a/pkg/scheduled_test/lib/src/schedule_error.dart |
| +++ b/pkg/scheduled_test/lib/src/schedule_error.dart |
| @@ -23,6 +23,10 @@ class ScheduleError extends AsyncError { |
| /// `null` if there was no such queue. |
| final TaskQueue queue; |
| + /// The descriptions of out-of-band callbacks that were pending when this |
| + /// error occurred. |
| + final Collection<String> pendingCallbacks; |
| + |
| /// The state of the schedule at the time the error was detected. |
| final ScheduleState _stateWhenDetected; |
| @@ -52,6 +56,8 @@ class ScheduleError extends AsyncError { |
| this.schedule = schedule, |
|
Bob Nystrom
2013/03/12 20:08:51
Are the "this."s needed here?
nweiz
2013/03/12 20:56:51
No, removed.
|
| this.task = schedule.currentTask, |
| this.queue = schedule.currentQueue, |
| + this.pendingCallbacks = schedule.currentQueue == null ? <String>[] |
| + : new List<String>.from(schedule.currentQueue.pendingCallbacks), |
|
Bob Nystrom
2013/03/12 20:08:51
schedule.currentQueue.pendingCallbacks.toList()
nweiz
2013/03/12 20:56:51
Done.
|
| this._stateWhenDetected = schedule.state; |
| bool operator ==(other) => other is ScheduleError && task == other.task && |
| @@ -88,6 +94,14 @@ class ScheduleError extends AsyncError { |
| result.write('Error detected before the schedule started running.'); |
| } |
| - return result.toString(); |
| + if (!pendingCallbacks.isEmpty) { |
| + result.write("\n\n"); |
| + result.writeln("Pending out-of-band callbacks:"); |
| + for (var callback in pendingCallbacks) { |
| + result.writeln("* $callback"); |
| + } |
| + } |
| + |
| + return result.toString().trim(); |
| } |
| } |