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

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

Issue 12637020: Display metadata about out-of-band callbacks in scheduled test errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: mege 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
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();
}
}

Powered by Google App Engine
This is Rietveld 408576698