diff options
author | vlad <vlad@driver.xyz> | 2017-07-17 19:35:53 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-07-17 19:35:53 -0700 |
commit | 01ead151be45774ed3fc08ef010215a5f5728498 (patch) | |
tree | 70ec5273736e67693be0d61cd2d9bb604505bfb4 /src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala | |
parent | 702b86748425650445b8b2278814474bab9ae27b (diff) | |
download | rest-query-01ead151be45774ed3fc08ef010215a5f5728498.tar.gz rest-query-01ead151be45774ed3fc08ef010215a5f5728498.tar.bz2 rest-query-01ead151be45774ed3fc08ef010215a5f5728498.zip |
Removing PasswordHash and jbCrypt lib from dependencies
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala b/src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala index af7d051..a9430e3 100644 --- a/src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala +++ b/src/main/scala/xyz/driver/pdsuicommon/computation/Computation.scala @@ -75,10 +75,7 @@ final case class Computation[+R, +T](future: Future[Either[R, T]]) { def mapAll[R2, T2](onLeft: R => Computation[R2, T2])(onRight: T => Computation[R2, T2])( onFailure: () => Computation[R2, T2])(implicit ec: ExecutionContext): Computation[R2, T2] = { - Computation(future.flatMap { success => - if (success.isRight) onRight(success.right.get).future - else onLeft(success.left.get).future - } recoverWith { + Computation(future.flatMap(_.fold(onLeft, onRight).future).recoverWith { case _ => onFailure().future }) } |