Created
February 15, 2021 13:39
-
-
Save abircse/39dc0dbf690aea54cd9793dbe4c4ee95 to your computer and use it in GitHub Desktop.
TryCatchExtension
This file contains hidden or 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 tryCatch(onTry: () -> Unit, onCatch: (Exception) -> Unit) { | |
try { | |
onTry.invoke() | |
} catch (e: Exception) { | |
onCatch.invoke(e) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment