Skip to content

Instantly share code, notes, and snippets.

@aleksandarzekovic
Created September 15, 2022 13:06
Show Gist options
  • Save aleksandarzekovic/7990f92c25ff1bfe1072d7b939b713ef to your computer and use it in GitHub Desktop.
Save aleksandarzekovic/7990f92c25ff1bfe1072d7b939b713ef to your computer and use it in GitHub Desktop.
private inline fun runSafely(completion: Continuation<*>, block: () -> Unit) {
try {
block()
} catch (e: Throwable) {
completion.resumeWith(Result.failure(e))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment