Created
June 5, 2020 11:33
-
-
Save TheBotBox/2979bc3221382eac85dde732f483d4ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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