Skip to content

Instantly share code, notes, and snippets.

@adamw
Last active June 7, 2019 20:09
Show Gist options
  • Save adamw/97bb19ff5608ab3306c1da28db75197b to your computer and use it in GitHub Desktop.
Save adamw/97bb19ff5608ab3306c1da28db75197b to your computer and use it in GitHub Desktop.
val ae = IO.async[Unit] { cb =>
ec3.submit(new Runnable {
override def run(): Unit = {
println(Thread.currentThread().getName + " (async)")
cb(Left(new IllegalStateException()))
}
})
}
run("async error") {
ae.guarantee(printThread)
}
/*
Outputs:
-- async error --
ec3-1-785992331 (async)
ec3-1-785992331
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment