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; | 5 library schedule; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 throw new StateError("Called abort() after the schedule has finished " | 181 throw new StateError("Called abort() after the schedule has finished " |
182 "running."); | 182 "running."); |
183 } | 183 } |
184 | 184 |
185 currentQueue._abort(); | 185 currentQueue._abort(); |
186 } | 186 } |
187 | 187 |
188 /// Signals that an out-of-band error has occurred. Using [wrapAsync] along | 188 /// Signals that an out-of-band error has occurred. Using [wrapAsync] along |
189 /// with `throw` is usually preferable to calling this directly. | 189 /// with `throw` is usually preferable to calling this directly. |
190 /// | 190 /// |
191 /// The metadata in [AsyncError]s and [ScheduleError]s will be preserved. | 191 /// The metadata in [ScheduleError]s will be preserved. |
192 void signalError(error, [stackTrace]) { | 192 void signalError(error, [stackTrace]) { |
193 heartbeat(); | 193 heartbeat(); |
194 | 194 |
195 var scheduleError = new ScheduleError.from(this, error, | 195 var scheduleError = new ScheduleError.from(this, error, |
196 stackTrace: stackTrace); | 196 stackTrace: stackTrace); |
197 if (_state == ScheduleState.DONE) { | 197 if (_state == ScheduleState.DONE) { |
198 throw new StateError( | 198 throw new StateError( |
199 "An out-of-band error was signaled outside of wrapAsync after the " | 199 "An out-of-band error was signaled outside of wrapAsync after the " |
200 "schedule finished running.\n" | 200 "schedule finished running.\n" |
201 "${errorString()}"); | 201 "${errorString()}"); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 return prefixLines(childString, | 598 return prefixLines(childString, |
599 firstPrefix: " $prefix ", prefix: " | "); | 599 firstPrefix: " $prefix ", prefix: " | "); |
600 }).join('\n'); | 600 }).join('\n'); |
601 taskString = '$taskString\n$childrenString'; | 601 taskString = '$taskString\n$childrenString'; |
602 } | 602 } |
603 | 603 |
604 return taskString; | 604 return taskString; |
605 }).join("\n"); | 605 }).join("\n"); |
606 } | 606 } |
607 } | 607 } |
OLD | NEW |