Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[writing-async-app-in-scala-part-2] Safe Exception Propagation
Future(42)
.map[Int](_ => throw new IllegalArgumentException)
.flatMap[Int](_ => throw new IllegalStateException)
// Effectively: Future.failed(new IllegalArgumentException)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment