From 38aa4e1024ca6f55bee2ed7bc85395d1d6fb0639 Mon Sep 17 00:00:00 2001 From: "floitsch@google.com" Date: Thu, 7 Feb 2013 16:49:06 +0000 Subject: [PATCH] Update doc for Future.whenComplete. Review URL: https://codereview.chromium.org//12207044 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18226 260f80e4-7a28-3924-810f-c04153c831b5 --- sdk/lib/async/future.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart index 0d32aaee8a3..a36ffa1c5dc 100644 --- a/sdk/lib/async/future.dart +++ b/sdk/lib/async/future.dart @@ -276,17 +276,20 @@ abstract class Future { * * If the call to [action] returns a [Future], `f2`, then completion of * `f` is delayed until `f2` completes. If `f2` completes with - * an error, that will be the result of `f` too. + * an error, that will be the result of `f` too. The value of `f2` is always + * ignored. * * This method is equivalent to: * * Future whenComplete(action()) { * this.then((v) { - * action(); + * var f2 = action(); + * if (f2 is Future) return f2.then((_) => v); * return v * }, * onError: (AsyncError e) { - * action(); + * var f2 = action(); + * if (f2 is Future) return f2.then((_) { throw e; }); * throw e; * }); * }