OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library schedule_error; | 5 library schedule_error; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:stack_trace/stack_trace.dart'; | 9 import 'package:stack_trace/stack_trace.dart'; |
10 | 10 |
11 import 'schedule.dart'; | 11 import 'schedule.dart'; |
12 import 'task.dart'; | 12 import 'task.dart'; |
13 import 'utils.dart'; | 13 import 'utils.dart'; |
14 | 14 |
15 /// A wrapper for errors that occur during a scheduled test. | 15 /// A wrapper for errors that occur during a scheduled test. |
16 class ScheduleError extends AsyncError { | 16 class ScheduleError extends AsyncError { |
17 /// The schedule during which this error occurred. | 17 /// The schedule during which this error occurred. |
18 final Schedule schedule; | 18 final Schedule schedule; |
19 | 19 |
20 /// The task that was running when this error occurred. This may be `null` if | 20 /// The task that was running when this error occurred. This may be `null` if |
21 /// there was no such task. | 21 /// there was no such task. |
22 final Task task; | 22 final Task task; |
23 | 23 |
24 /// The task queue that was running when this error occured. This may be | 24 /// The task queue that was running when this error occured. This may be |
25 /// `null` if there was no such queue. | 25 /// `null` if there was no such queue. |
26 final TaskQueue queue; | 26 final TaskQueue queue; |
27 | 27 |
28 /// The descriptions of out-of-band callbacks that were pending when this | 28 /// The descriptions of out-of-band callbacks that were pending when this |
29 /// error occurred. | 29 /// error occurred. |
30 final Collection<String> pendingCallbacks; | 30 final Iterable<String> pendingCallbacks; |
31 | 31 |
32 /// The state of the schedule at the time the error was detected. | 32 /// The state of the schedule at the time the error was detected. |
33 final ScheduleState _stateWhenDetected; | 33 final ScheduleState _stateWhenDetected; |
34 | 34 |
35 int get hashCode => schedule.hashCode ^ task.hashCode ^ queue.hashCode ^ | 35 int get hashCode => schedule.hashCode ^ task.hashCode ^ queue.hashCode ^ |
36 _stateWhenDetected.hashCode ^ error.hashCode ^ stackTrace.hashCode ^ | 36 _stateWhenDetected.hashCode ^ error.hashCode ^ stackTrace.hashCode ^ |
37 cause.hashCode; | 37 cause.hashCode; |
38 | 38 |
39 /// Creates a new [ScheduleError] wrapping [error]. The metadata in | 39 /// Creates a new [ScheduleError] wrapping [error]. The metadata in |
40 /// [AsyncError]s and [ScheduleError]s will be preserved. | 40 /// [AsyncError]s and [ScheduleError]s will be preserved. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 result.write("\n\n"); | 107 result.write("\n\n"); |
108 result.writeln("Pending out-of-band callbacks:"); | 108 result.writeln("Pending out-of-band callbacks:"); |
109 for (var callback in pendingCallbacks) { | 109 for (var callback in pendingCallbacks) { |
110 result.writeln(prefixLines(callback, firstPrefix: "* ")); | 110 result.writeln(prefixLines(callback, firstPrefix: "* ")); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 return result.toString().trim(); | 114 return result.toString().trim(); |
115 } | 115 } |
116 } | 116 } |
OLD | NEW |