Created
May 23, 2020 22:29
-
-
Save dkomanov/4b350c620e0da4189b6e2122f45e0557 to your computer and use it in GitHub Desktop.
[writing-async-app-in-scala-part-2] Unsafe Exception Propagation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def innocentFunction(param: AnyRef): Future[Int] = { | |
require(param != null) | |
Future.successful(42) | |
} | |
innocentFunction(null) | |
.map(_ => throw new IllegalStateException) | |
// an IllegalArgumentException will be thrown before map call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment