Skip to content

Instantly share code, notes, and snippets.

@kolov
Last active March 6, 2018 23:12
Show Gist options
  • Save kolov/708b597021741d76bf72f2db7ea3a627 to your computer and use it in GitHub Desktop.
Save kolov/708b597021741d76bf72f2db7ea3a627 to your computer and use it in GitHub Desktop.
def getDates(product: String): Future[Either[String, List[LocalDate]]] = product match {
case "fast" => Future.successful(Right(List(LocalDate.parse("2018-03-09"), LocalDate.parse("2018-03-10"))))
case "slow" => Future.successful(Right(List(LocalDate.parse("2018-03-07"), LocalDate.parse("2018-03-08"))))
case "express" => Future.successful(Left("Service not available"))
case "flash" => Future.failed(new Throwable("haha"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment