in app/models/Attempt.scala [98:128]
def Right[A](a: A): Attempt[A] =
Attempt(Future.successful(scala.Right(a)))
/**
* Create an Attempt failure from an AMIableErrors instance.
*/
def Left[A](err: AttemptErrors): Attempt[A] =
Attempt(Future.successful(scala.Left(err)))
def Left[A](err: AttemptError): Attempt[A] =
Attempt(Future.successful(scala.Left(AttemptErrors(err))))
/**
* Asyncronous versions of the Attempt Right/Left helpers for when you have
* a Future that returns a good/bad value directly.
*/
object Async {
/**
* Create an Attempt from a Future of a good value.
*/
def Right[A](fa: Future[A])(implicit ec: ExecutionContext): Attempt[A] =
Attempt(fa.map(scala.Right(_)))
/**
* Create an Attempt from a known failure in the future. For example,
* if a piece of logic fails but you need to make a Database/API call to
* get the failure information.
*/
def Left[A](ferr: Future[AttemptErrors])(implicit ec: ExecutionContext): Attempt[A] =
Attempt(ferr.map(scala.Left(_)))
}