Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
inline fun <reified E : Throwable> tryAndCatch(blockTry: () -> Unit, blockCatch: (E) -> Unit) {
try {
blockTry()
} catch (e: Exception) {
blockCatch(e as E)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment