title: How to fail an akka promise?
body: <p>Suppose I have a function like this (I use akka 2.0.2):</p>
  
  <pre><code>def foo(message: String): Future[SomeClass] =
    for {
      result &lt;- actor ? message
    } yield SomeClass(result)
  </code></pre>
  
  <p>The caller of a function sets <code>onSuccess</code> and <code>onFailure</code> hooks on the future, so if I want an actor to break the promise, I make it send <code>akka.actor.Status.Failure</code> back to the sender. That works just fine. Now, what if I want to check some condition in <code>foo</code> and return the failed future in case condition fails/succeeds?</p>
  
  <pre><code>def foo(message: String): Future[SomeClass] =
    if(...) {
      ...//return failed future
    } else {
      for {
        result &lt;- actor ? message
      } yield SomeClass(result)
    }
  </code></pre>
  
  <p>What the 'return failed future' block should be like? And do I need an execution context to implement it?</p>