Skip to content

Instantly share code, notes, and snippets.

@bantonsson
Last active October 13, 2015 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bantonsson/4110274 to your computer and use it in GitHub Desktop.
Save bantonsson/4110274 to your computer and use it in GitHub Desktop.
Spotlight for Futures
Spotlight for Futures
// Akka 2.0
def square(i: Int): Future[Int] = Promise successful i * i
// Akka 2.1
def square(i: Int): Future[Int] = Future successful i * i
// Akka 2.0
val failedFilter = future1.filter(_ % 2 == 1).recover {
case m: MatchError => //When filter fails, it will have a MatchError
}
// Akka 2.1
val failedFilter = future1.filter(_ % 2 == 1).recover {
// When filter fails, it will have a java.util.NoSuchElementException
case m: NoSuchElementException =>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment