Permalink
Browse files

fix erring promise chaining

  • Loading branch information...
1 parent f0c6511 commit 7e67bf2f50ed98c5bca9d14720dfe7c7421957d2 @sadache sadache committed Mar 15, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 framework/src/play/src/main/scala/play/api/libs/concurrent/Promise.scala
@@ -192,7 +192,12 @@ class STMPromise[A] extends Promise[A] with Redeemable[A] {
val result = new STMPromise[B]()
this.addAction(p => p.value match {
case Redeemed(a) =>
- (try{ f(a)}catch{case e => {println("wow! "+e); throw e}}).extend(ip => ip.value match {
+ (try{
+ f(a)
+ } catch{
+ case e =>
+ Promise.pure[B](throw e)
+ }).extend(ip => ip.value match {
case Redeemed(a) => result.redeem(a)
case Thrown(e) => result.redeem(throw e)
@@ -246,7 +251,7 @@ object PurePromise {
object Promise {
- def pure[A](a: A): Promise[A] = PurePromise(a)
+ def pure[A](a: => A): Promise[A] = PurePromise(a)
def apply[A](): Promise[A] with Redeemable[A] = new STMPromise[A]()

0 comments on commit 7e67bf2

Please sign in to comment.