Skip to content

Instantly share code, notes, and snippets.

@cldellow
Created November 28, 2013 23:44
Show Gist options
  • Select an option

  • Save cldellow/7699599 to your computer and use it in GitHub Desktop.

Select an option

Save cldellow/7699599 to your computer and use it in GitHub Desktop.
Exceptions and promises
import dispatch._
def func = Http(host("exaadsfadsfmple.com") OK as.String)
try {
val rv = func.flatMap { _ => Promise(1) }
rv() // Doesn't reach here, prints out message
println("I'll never get here")
} catch {
case e: Exception => println("I'll catch this, but you'll still see the JRE printing a stack trace for a BG thread")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment