| 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 'schedule.dart'; | 9 import 'schedule.dart'; |
| 10 import 'task.dart'; | 10 import 'task.dart'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (error is ScheduleError) return error; | 41 if (error is ScheduleError) return error; |
| 42 | 42 |
| 43 if (error is AsyncError) { | 43 if (error is AsyncError) { |
| 44 // Overwrite the explicit stack trace, because it probably came from a | 44 // Overwrite the explicit stack trace, because it probably came from a |
| 45 // rethrow in the first place. | 45 // rethrow in the first place. |
| 46 stackTrace = error.stackTrace; | 46 stackTrace = error.stackTrace; |
| 47 if (cause == null) cause = error.cause; | 47 if (cause == null) cause = error.cause; |
| 48 error = error.error; | 48 error = error.error; |
| 49 } | 49 } |
| 50 | 50 |
| 51 if (stackTrace == null) { |
| 52 try { |
| 53 throw ''; |
| 54 } catch (_, thrownStackTrace) { |
| 55 stackTrace = thrownStackTrace; |
| 56 } |
| 57 } |
| 58 |
| 51 return new ScheduleError(schedule, error, stackTrace, cause); | 59 return new ScheduleError(schedule, error, stackTrace, cause); |
| 52 } | 60 } |
| 53 | 61 |
| 54 ScheduleError(Schedule schedule, error, stackTrace, AsyncError cause) | 62 ScheduleError(Schedule schedule, error, stackTrace, AsyncError cause) |
| 55 : super.withCause(error, stackTrace, cause), | 63 : super.withCause(error, stackTrace, cause), |
| 56 schedule = schedule, | 64 schedule = schedule, |
| 57 task = schedule.currentTask, | 65 task = schedule.currentTask, |
| 58 queue = schedule.currentQueue, | 66 queue = schedule.currentQueue, |
| 59 pendingCallbacks = schedule.currentQueue == null ? <String>[] | 67 pendingCallbacks = schedule.currentQueue == null ? <String>[] |
| 60 : schedule.currentQueue.pendingCallbacks.toList(), | 68 : schedule.currentQueue.pendingCallbacks.toList(), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 result.write("\n\n"); | 106 result.write("\n\n"); |
| 99 result.writeln("Pending out-of-band callbacks:"); | 107 result.writeln("Pending out-of-band callbacks:"); |
| 100 for (var callback in pendingCallbacks) { | 108 for (var callback in pendingCallbacks) { |
| 101 result.writeln("* $callback"); | 109 result.writeln("* $callback"); |
| 102 } | 110 } |
| 103 } | 111 } |
| 104 | 112 |
| 105 return result.toString().trim(); | 113 return result.toString().trim(); |
| 106 } | 114 } |
| 107 } | 115 } |
| OLD | NEW |