title: Try Failure is not catching exceptions
body: <p>In the code below I have two Play for Scala functions, the first one catches an exception (this works fine) and in the second one I'm trying to rewrite it using <code>Try</code>.</p>
  
  <p>I have two problems with <code>Try</code>: (1) when the number is negative the method doesn't fail, (2) I need to wrap all the responses with <code>Future.successful</code>.</p>
  
  <p>How to fix this code?</p>
  
  <pre><code>  class Test extends Controller  {
  
      def test1 = Action.async { request =&gt;
  
           val future = isPositive(-1)
           future.map { result =&gt;
               Ok("OK, it's positive")
           }
           .recover { 
               case e =&gt; Ok(e.getMessage)
           }
      }
  
      def isPositive(i: Int) = Future {
          if (i&lt;0)
              throw new Exception ( "Number is negative" )
          else
              i
      }
  
      def test2 = Action.async { request =&gt;
          isPositiveWithTry(-1) match {
              case Success(s) =&gt; Future.successful(Ok("OK, it's positive (Try succeded)"))
              case Failure(f) =&gt; Future.successful(Ok(f.getMessage + " (Try failed)"))
          }
      }
  
      def isPositiveWithTry(i: Int) : Try[Future[Int]] = Try {
           isPositive(i)
      }
  
   }
  </code></pre>