title: scala Futures: possible to find out if an 'onFailure' callback has been installed (so we can implement default error handling)?
body: <p>My question is somewhat related to <a href="https://stackoverflow.com/questions/24453080/scala-futures-default-error-handler-for-every-new-created-or-mapped-exception">this question</a> about default error handlers for Scala futures. </p>
  
  <p>The twist is, I want to install a default error handler that only kicks in if no onFailure (or onComplete)
  callback has been installed on the Future.  I think this would be quite useful because i have 
   written code where my Futures fail silently leaving me confused about what's going on.
  A fallback  error handler would enable me to easily identify errant Futures for which an 
  appropriate onFailure  callback was never defined.</p>
  
  <p>Below is a code sample which illustrates where this could be useful.</p>
  
  <pre><code>  import scala.concurrent.ExecutionContext.Implicits.global
    import scala.concurrent._
    import scala.language.implicitConversions
    import scala.language.postfixOps
  
    def futureWithLogging[T](fut: Future[T]) =
      fut.transform(identity, { t: Throwable =&gt;
        Console.err.println(s"failed with $t")
        t
      })
  
  
    {
      val f = futureWithLogging ( Future {
        Thread.sleep(1000)
        throw new scala.RuntimeException("")
      } )
  
      f.onFailure{ case err:Throwable =&gt; {println("custom error message"); err.printStackTrace()} }
  
      println(s"future value is: ${f.value}")
      Thread.sleep(1000)
      println(s"future value is now: ${f.value}")
      Thread.sleep(1000)
    }
  </code></pre>
  
  <p>Notice that I have a 
  futureWithLogging function which installs some default error handling behavior on any future that
  you pass into the function.  Now, if I forget to install an onFailure on a future this is very handy.
  But in the code above you see that I have an onFailure handler is installed on Future 'f'.
  The result is that I get noise in my log.  I see two error messages:</p>
  
  <pre><code>  failed with &lt;exception&gt;  
  </code></pre>
  
  <p>and</p>
  
  <pre><code>   custom error message...
  </code></pre>
  
  <p>Where in this case I only want to see the second one</p>
  
  <p>Any guidance you could provide is much appreciated !</p>