Created
November 16, 2015 20:10
-
-
Save durre/67fd5010ab840e3c0598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object FutureUtils { | |
def sequenceOr[T](result: Or[Future[T], ErrorMessage]): Future[Or[T, ErrorMessage]] = { | |
result match { | |
case Good(futureValue) => futureValue.map(Good(_)) | |
case Bad(msg) => Future.successful(Bad(msg)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment