You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some code that makes an async call do decide which exception to throw. This seems to generate an assignment to ??? in the calling method when that exception state is skipped.
importscala.async.Async._importscala.concurrent.duration.Durationimportscala.concurrent.{Await, Future}
importscala.concurrent.ExecutionContext.Implicits.globaldeferrorGenerator(randomNum: Double) = {
Future {
if (randomNum <0) {
thrownewIllegalStateException("Random number was too low!")
} else {
thrownewIllegalStateException("Random number was too high!")
}
}
}
defrandomTimesTwo= async {
valnum= math.random
if (num <0|| num >1) {
await(errorGenerator(num))
}
num *2
}
println(Await.result(randomTimesTwo, Duration("1 second")))
results in
java.util.concurrent.ExecutionException: Boxed Error
at scala.concurrent.impl.Promise$.resolver(Promise.scala:55)
at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:47)
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:244)
at scala.concurrent.Promise$class.complete(Promise.scala:55)
at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153)
at A$A110$A$A110$stateMachine$macro$1$1.resume(playground.sc0.tmp:20)
at A$A110$A$A110$stateMachine$macro$1$1.resume(playground.sc0.tmp:20)
at A$A110$A$A110$stateMachine$macro$1$1.apply$mcV$sp(playground.sc0.tmp:20)
at A$A110$A$A110$stateMachine$macro$1$1.apply(playground.sc0.tmp:20)
at A$A110$A$A110$stateMachine$macro$1$1.apply(playground.sc0.tmp:20)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225)
... 12 more
Tried this on async 0.9.2 & 0.9.3, Scala 2.11.4.
The text was updated successfully, but these errors were encountered:
I have some code that makes an async call do decide which exception to throw. This seems to generate an assignment to
???
in the calling method when that exception state is skipped.results in
Tried this on async 0.9.2 & 0.9.3, Scala 2.11.4.
The text was updated successfully, but these errors were encountered: