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

Unified Diff: lib/core/future.dart

Issue 11225017: Improvement on future: add stack trace to future failures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | lib/coreimpl/future_implementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/core/future.dart
diff --git a/lib/core/future.dart b/lib/core/future.dart
index 99af2415180efcd019af18bce4ad6a7800ef087b..ea395491141149aced37fdb6ab0e4437d01a72e1 100644
--- a/lib/core/future.dart
+++ b/lib/core/future.dart
@@ -193,6 +193,22 @@ class FutureAlreadyCompleteException implements Exception {
String toString() => "Exception: future already completed";
}
+/**
+ * Wraps unhandled exceptions provided to [Completer.completeException]. It is
+ * used to show both the error message and the stack trace for unhandled
+ * exceptions.
+ */
+class FutureUnhandledException implements Exception {
+ /** Wrapped exception. */
+ var source;
+
+ /** Trace for the wrapped exception. */
+ var stackTrace;
+
+ FutureUnhandledException(this.source, this.stackTrace);
Jennifer Messerly 2012/10/19 23:54:15 nit: newline after this
+ String toString() => "$source\n$stackTrace".replaceAll('\n','\n ');
Jennifer Messerly 2012/10/19 23:54:15 include more context here? maybe something like:
+}
+
/**
* [Futures] holds additional utility functions that operate on [Future]s (for
« no previous file with comments | « no previous file | lib/coreimpl/future_implementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698