This file contains 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 characters
/** | |
* Helper class to use future-options in for-comprehension-loops | |
* Use this class as a combined future/option so handling becomes more easy on these | |
* objects. Any empty options will short-circuit the future chain and any exceptions | |
* in a future will result in a future-none result. | |
* Available under MIT license. | |
*/ | |
case class Maybe[+A](val maybe: Future[Option[A]]) extends AnyVal | |
{ import scala.util.control.NonFatal | |
def value = maybe.recoverWith{ case NonFatal(_) => Maybe.never } |