Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Created May 23, 2020 22:28
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 dkomanov/d96e1fba65907591e9ec8ef2f2c3223f to your computer and use it in GitHub Desktop.
Save dkomanov/d96e1fba65907591e9ec8ef2f2c3223f to your computer and use it in GitHub Desktop.
[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