Index: sdk/lib/async/async_error.dart |
diff --git a/sdk/lib/async/async_error.dart b/sdk/lib/async/async_error.dart |
index 05fbb88b211b769782bcc8d43639fdbc52ff98c5..6cea8a57d013addc5831ccb0d129e14697e56030 100644 |
--- a/sdk/lib/async/async_error.dart |
+++ b/sdk/lib/async/async_error.dart |
@@ -25,3 +25,30 @@ getAttachedStackTrace(o) { |
if (o == null || o is bool || o is num || o is String) return null; |
return _stackTraceExpando[o]; |
} |
+ |
+// TODO(floitsch): should we make this an Error class? Probably depends, if we |
+// want to make the class public. |
Lasse Reichstein Nielsen
2013/10/04 09:17:39
We can implement Error without problems. We have t
floitsch
2013/10/05 17:22:59
Done.
|
+class _AsyncError { |
+ final error; |
+ final StackTrace stackTrace; |
+ |
+ _AsyncError(this.error, this.stackTrace); |
+} |
+ |
+class _UncaughtAsyncError extends _AsyncError { |
+ _UncaughtAsyncError(error, StackTrace stackTrace) : super(error, stackTrace); |
+ |
+ String toString() { |
+ String result = "Uncaught Error: ${error}"; |
+ var trace = stackTrace; |
+ if (trace == null) trace = getAttachedStackTrace(error); |
Lasse Reichstein Nielsen
2013/10/04 09:17:39
This looks wrong to me. If anything, the attached
floitsch
2013/10/05 17:22:59
done.
|
+ |
+ // Clear the attached stack trace. |
+ _attachStackTrace(error, null); |
+ |
+ if (trace != null) { |
+ result += "\nStack Trace:\n$trace"; |
+ } |
+ return result; |
+ } |
+} |