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

Unified Diff: sdk/lib/async/async_error.dart

Issue 25027004: Add second argument to Future error handlers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Upload Created 7 years, 2 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
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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698