ExecutionException - stored when the computation fails due to an unhandled InterruptedException, Error or a scala.util.control.ControlThrowable. In this case the ExecutionException has the unhandled exception as its cause. These exceptions are rethrown in the thread executing the failed asynchronous computation.
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_40).
import scala.concurrent.Futureimport scala.concurrent.ExecutionContextimport scala.util.{Failure, Success}
implicit object SameThreadExecutionContext extends ExecutionContext {override def execute(runnable: Runnable): Unit = {println("DEBUG: running " + runnable)runnable.run()}override def reportFailure(t: Throwable): Unit = ??? // never called?}scala> Future { throw new Error("bang!") }.valueDEBUG: running scala.concurrent.impl.Future$PromiseCompletingRunnable@887b5d0res1: Option[scala.util.Try[Nothing]] = Some(Failure(java.util.concurrent.ExecutionException: Boxed Error))
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
scala> Future { throw new InterruptedException("bang!") }.valueDEBUG: running scala.concurrent.impl.Future$PromiseCompletingRunnable@7e6ce0a3java.lang.InterruptedException: bang!at $anonfun$1.apply(<console>:12)at $anonfun$1.apply(<console>:12)at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)at SameThreadExecutionContext$.execute(<console>:13)at scala.concurrent.impl.Future$.apply(Future.scala:31)at scala.concurrent.Future$.apply(Future.scala:492)... 33 elided
Andrew,
Indeed, also see revisions to NonFatal.
--
Cheers,
√