From 24250d0da6e2aed7f5984a04a0e7f77da5c4055c Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Mon, 11 Jul 2011 14:51:23 +0200 Subject: [PATCH] Changing 'flow' to use onException instead of other boilerplate --- akka-actor/src/main/scala/akka/dispatch/Future.scala | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/akka-actor/src/main/scala/akka/dispatch/Future.scala b/akka-actor/src/main/scala/akka/dispatch/Future.scala index 7cbce211ca..a02b0c8910 100644 --- a/akka-actor/src/main/scala/akka/dispatch/Future.scala +++ b/akka-actor/src/main/scala/akka/dispatch/Future.scala @@ -267,12 +267,7 @@ object Future { */ def flow[A](body: ⇒ A @cps[Future[Any]], timeout: Long = Actor.TIMEOUT): Future[A] = { val future = Promise[A](timeout) - (reset(future.asInstanceOf[Promise[Any]].completeWithResult(body)): Future[Any]) onComplete { - _.exception match { - case Some(e) ⇒ future completeWithException e - case None ⇒ - } - } + (reset(future.asInstanceOf[Promise[Any]].completeWithResult(body)): Future[Any]) onException { case e => future completeWithException e } future } }