Last active
          August 29, 2015 13:57 
        
      - 
      
 - 
        
Save matthandlersux/9403412 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
matt handler revised this gist
Mar 7, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,13 @@ package util object FutureOption { implicit class WithFutureOption[A](self: Future[Option[A]]) { def flatMapOption[T](e: => Exception)(f: A => Future[T]): Future[T] = { self flatMap { _ map f getOrElse Future.failed(e) } } def mapOption[T](e: => Exception)(f: A => T): Future[T] = { self map { _ map f getOrElse (throw e) }  - 
        
matt handler revised this gist
Mar 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ package util object FutureOption { implicit class WithFutureOption[A](self: Future[Option[A]]) { def flatMapOption[T](e: Exception)(f: A => Future[T]): Future[T] = { self flatMap {  - 
        
matt handler created this gist
Mar 7, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ package util object FlatMapOption { implicit class WithFutureOption[A](self: Future[Option[A]]) { def flatMapOption[T](e: Exception)(f: A => Future[T]): Future[T] = { self flatMap { _ map f getOrElse Future.failed(e) } } def mapOption[T](e: Exception)(f: A => T): Future[T] = { self map { _ map f getOrElse (throw e) } } } }