-
Notifications
You must be signed in to change notification settings - Fork 90
scala.NotImplementedError when evaluating a failed Future #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What is the status on this. It seems to be a pretty important case of the whole async/await flow. If Exceptions cannot be thrown, then how should i have the courage to use this lib? |
Thanks for the report. You can workaround this issue by annotating the type if val f: Future[Any] = Future.failed(new Exception())
async {
await(f)
} I'll include the fix for this bug in a new release of async in the coming weeks. |
I can confirm the workaround works. import scala.async.Async.{async, await}
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
val f: Future[String] = Future.failed(new Exception("test"))
val result = async {
await(f)
}
Await.result(result, Duration.Inf) outputs
It means that his error would never occur in real application code. |
I've just deployed scala-async 0.9.2 to Sonatype. |
The following worksheet:
delivers the following error
The text was updated successfully, but these errors were encountered: