Skip to content

Instantly share code, notes, and snippets.

@adamw
Created June 7, 2019 20:10
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 adamw/d5aeeb1b44535004e5fb7539d7aab295 to your computer and use it in GitHub Desktop.
Save adamw/d5aeeb1b44535004e5fb7539d7aab295 to your computer and use it in GitHub Desktop.
val ae = IO.effectAsync[Any, Throwable, Unit] { cb =>
ec3.submit(new Runnable {
override def run(): Unit = {
println(Thread.currentThread().getName + " (async)")
cb(IO.fail(new IllegalStateException()))
}
})
}
run("async shift error") {
ae.ensuring(printThread.either)
}
/*
Outputs:
-- async shift error --
ec3-1-1627960023 (async)
zio-default-async-11-853993923
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment