converting Akka's Future[A] to Future[Either[Exception,A]]

后端 未结 3 1520
栀梦
栀梦 2020-12-09 21:56

Is there a method in Akka (or in the standard library in Scala 2.10) to convert a Future[A] which might fail into a Future[Either[Exception,A]]? I

3条回答
  •  Happy的楠姐
    2020-12-09 22:55

    Another version of such conversion (in standard Scala):

    f.transform(tryResult => Success(tryResult.toEither))
    

提交回复
热议问题