0
votes

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.

1

1 Answers

4
votes

As I always say, the Scaladoc is your friend.

def rethrowT(implicit F: MonadError[F, _ >: A]): F[B]

Given MonadError[F, E :> A] transforms Either[F, A, B] to F[B] If the value was B, F[B] is successful If the value was A, F[B] is failed with E.

All you need to do is:

resultT.rethrowT