Changing 'flow' to use onException instead of other boilerplate
This commit is contained in:
parent
3c98cce8f0
commit
24250d0da6
1 changed files with 1 additions and 6 deletions
|
|
@ -267,12 +267,7 @@ object Future {
|
||||||
*/
|
*/
|
||||||
def flow[A](body: ⇒ A @cps[Future[Any]], timeout: Long = Actor.TIMEOUT): Future[A] = {
|
def flow[A](body: ⇒ A @cps[Future[Any]], timeout: Long = Actor.TIMEOUT): Future[A] = {
|
||||||
val future = Promise[A](timeout)
|
val future = Promise[A](timeout)
|
||||||
(reset(future.asInstanceOf[Promise[Any]].completeWithResult(body)): Future[Any]) onComplete {
|
(reset(future.asInstanceOf[Promise[Any]].completeWithResult(body)): Future[Any]) onException { case e => future completeWithException e }
|
||||||
_.exception match {
|
|
||||||
case Some(e) ⇒ future completeWithException e
|
|
||||||
case None ⇒
|
|
||||||
}
|
|
||||||
}
|
|
||||||
future
|
future
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue