summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Prokopec <aleksandar.prokopec@gmail.com>2011-12-07 16:00:48 +0100
committerAleksandar Prokopec <aleksandar.prokopec@gmail.com>2011-12-07 16:00:48 +0100
commitcb8e0de9538ec57a90fd71c47e20b7319c4904cc (patch)
tree277c687be8b85ede4bb6650782e9280e7243acd1
parent4b62e8059c1f0f8cb4624291b0aa64e6e460948e (diff)
downloadscala-cb8e0de9538ec57a90fd71c47e20b7319c4904cc.tar.gz
scala-cb8e0de9538ec57a90fd71c47e20b7319c4904cc.tar.bz2
scala-cb8e0de9538ec57a90fd71c47e20b7319c4904cc.zip
Fixed the docs a bit.
-rw-r--r--src/library/scala/concurrent/Future.scala14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala
index eff155f5e9..5f64c2fc1a 100644
--- a/src/library/scala/concurrent/Future.scala
+++ b/src/library/scala/concurrent/Future.scala
@@ -38,10 +38,13 @@ import java.util.concurrent.atomic.{ AtomicReferenceFieldUpdater, AtomicInteger,
* @define caughtThrowables
* The future may contain a throwable object and this means that the future failed.
* Futures obtained through combinators have the same exception as the future they were obtained from.
- * The following throwable objects are treated differently:
+ * The following throwable objects are not caught by the future:
* - Error - errors are not contained within futures
* - scala.util.control.ControlException - not contained within futures
* - InterruptedException - not contained within futures
+ *
+ * Instead, the future is completed with a NoSuchElementException with one of the exceptions above
+ * as the cause.
*
* @define forComprehensionExamples
* Example:
@@ -95,8 +98,9 @@ self =>
*
* $multipleCallbacks
*/
- def onFailure[U](func: Throwable => U): this.type = onComplete {
- case Left(t) if isFutureThrowable(t) => func(t)
+ def onFailure[U](callback: Throwable => U): this.type = onComplete {
+ case Left(te: FutureTimeoutException) => callback(te)
+ case Left(t) if isFutureThrowable(t) => callback(t)
case Right(v) => // do nothing
}
@@ -107,8 +111,8 @@ self =>
*
* $multipleCallbacks
*/
- def onTimeout[U](body: FutureTimeoutException => U): this.type = onComplete {
- case Left(te: FutureTimeoutException) => body(te)
+ def onTimeout[U](callback: FutureTimeoutException => U): this.type = onComplete {
+ case Left(te: FutureTimeoutException) => callback(te)
case Right(v) => // do nothing
}