Last active
September 28, 2016 20:08
-
-
Save eboto/7fdd63a3419d9a026334d8373ab44540 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// If you create a Future inside another Future, the inner one | |
// will not log exceptions thrown in its body to the console. | |
// | |
// Why not? | |
// | |
// Example: | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.Future | |
val fut = Future { | |
Future { | |
println("This print will show in the logs...") | |
throw new RuntimeException("But this exception never appears in the logs!") | |
} | |
1 | |
} | |
Future { | |
throw new RuntimeException("This non-nested throwaway Future _also_ doesn't appear") | |
} | |
fut.foreach { _ => throw new RuntimeException("This exception appears also, as expected.") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment