Skip to content

Instantly share code, notes, and snippets.

@dmytrodanylyk
Created October 9, 2017 04:58
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 dmytrodanylyk/4b78d3b8edd8d83e356129ee61eefeef to your computer and use it in GitHub Desktop.
Save dmytrodanylyk/4b78d3b8edd8d83e356129ee61eefeef to your computer and use it in GitHub Desktop.
var job: Job? = null
fun startPresenting() {
job = loadData()
job?.invokeOnCompletion { it: Throwable? ->
it?.printStackTrace() // (1)
// or
job?.getCompletionException()?.printStackTrace() // (2)
// difference between (1) and (2) is that (1) will NOT contain CancellationException
// in case if job was cancelled
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment