Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example 1 Helper
internal suspend inline fun <T> getResult(block: () -> T): Result<T> = try {
block().let { Result.success(it) }
} catch (e: Exception) {
// Ensure coroutine cancellation can propagate to parent coroutine
if (e is CancellationException) throw e
// TODO Log with diagnostic information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment