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

Unified Diff: lib/core/future.dart

Issue 10908040: Support transforming the exception in Future.transform(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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') | tests/corelib/future_test.dart » ('J')
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 6b2fa19e3e82b3c5abb094af4f21570117fab0a5..db238ec4057dcded2d97b9be96ee50220c7586e3 100644
--- a/lib/core/future.dart
+++ b/lib/core/future.dart
@@ -104,8 +104,16 @@ interface Future<T> default FutureImpl<T> {
*
* You must not add exception handlers to [this] future prior to calling
* transform, and any you add afterwards will not be invoked.
+ *
+ * The [onException] parameter can be provided to control how exceptions
+ * received by this future or the transformation are handled. If an exception
+ * occures, [onException] will be called. If that throws an exception, the
+ * returned future will complete with that exception. If it returns `true`,
+ * then the exception is considered handled and is not propogated to the
+ * returned future. If it returns anything else, the original exception will
+ * be propogated.
*/
- Future transform(transformation(T value));
+ Future transform(transformation(T value), [onException(Object exception)]);
Siggi Cherem (dart-lang) 2012/09/04 16:56:33 maybe use [bool onException(Object exception)]? (a
/**
* A future representing an asynchronous transformation applied to this
« no previous file with comments | « no previous file | lib/coreimpl/future_implementation.dart » ('j') | tests/corelib/future_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698