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

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

Issue 14251006: Remove AsyncError with Expando. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule.dart ('k') | pkg/scheduled_test/lib/src/scheduled_future_matchers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7b66391a17ef3adadd6ad2c9aeee498268fc9cee..09bb35095daebf429c384a618e37ca376731395b 100644
--- a/pkg/scheduled_test/lib/src/schedule_error.dart
+++ b/pkg/scheduled_test/lib/src/schedule_error.dart
@@ -13,7 +13,13 @@ import 'task.dart';
import 'utils.dart';
/// A wrapper for errors that occur during a scheduled test.
-class ScheduleError extends AsyncError {
+class ScheduleError {
+ /// The wrapped error.
+ final error;
+
+ /// The stack trace that was attached to the error. Can be `null`.
+ final stackTrace;
+
/// The schedule during which this error occurred.
final Schedule schedule;
@@ -33,33 +39,33 @@ class ScheduleError extends AsyncError {
final ScheduleState _stateWhenDetected;
int get hashCode => schedule.hashCode ^ task.hashCode ^ queue.hashCode ^
- _stateWhenDetected.hashCode ^ error.hashCode ^ stackTrace.hashCode ^
- cause.hashCode;
+ _stateWhenDetected.hashCode ^ error.hashCode ^ stackTrace.hashCode;
/// Creates a new [ScheduleError] wrapping [error]. The metadata in
- /// [AsyncError]s and [ScheduleError]s will be preserved.
- factory ScheduleError.from(Schedule schedule, error, {StackTrace stackTrace,
- AsyncError cause}) {
+ /// [ScheduleError]s will be preserved.
+ factory ScheduleError.from(Schedule schedule, error,
+ {StackTrace stackTrace}) {
if (error is ScheduleError) return error;
- if (error is AsyncError) {
+ var attachedTrace = getAttachedStackTrace(error);
+ if (attachedTrace != null) {
// Overwrite the explicit stack trace, because it probably came from a
// rethrow in the first place.
- stackTrace = error.stackTrace;
- if (cause == null) cause = error.cause;
- error = error.error;
+ stackTrace = attachedTrace;
}
if (schedule.captureStackTraces && stackTrace == null) {
stackTrace = new Trace.current();
}
- return new ScheduleError(schedule, error, stackTrace, cause);
+ return new ScheduleError(schedule, error, stackTrace);
}
- ScheduleError(Schedule schedule, error, StackTrace stackTrace,
- AsyncError cause)
- : super.withCause(error, stackTrace, cause),
+ // TODO(floitsch): restore StackTrace type when it has been integrated into
+ // the core libraries.
+ ScheduleError(Schedule schedule, error, var stackTrace)
+ : error = error,
+ stackTrace = stackTrace,
schedule = schedule,
task = schedule.currentTask,
queue = schedule.currentQueue,
@@ -69,8 +75,7 @@ class ScheduleError extends AsyncError {
bool operator ==(other) => other is ScheduleError && task == other.task &&
queue == other.queue && _stateWhenDetected == other._stateWhenDetected &&
- error == other.error && stackTrace == other.stackTrace &&
- cause == other.cause;
+ error == other.error && stackTrace == other.stackTrace;
String toString() {
var result = new StringBuffer();
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule.dart ('k') | pkg/scheduled_test/lib/src/scheduled_future_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698