I have result like:
EitherT[Future, IllegalStateException, Result]
how to convert to Future[Result]? And let Future fail with this IllegalStateException? I know I can do like resultT.value to get Future[Either[Exception, Res]] and convert it but maybe there is simpler way.
There isn't really any simpler version to do it than what you've mentioned. But the conversion isn't hard to do either, so there isn't really a need.
import scala.util.chaining._
resultT.value.flatMap(_.toTry.pipe(Future.fromTry))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.