Created
July 11, 2019 14:58
-
-
Save Francescu/f2e3158032eaed00e13712b993ded56f 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 <T>tryOrNull(action: () -> T): T? { | |
var ret: T? | |
try { | |
ret = action() | |
} catch (e: Exception) { | |
ret = null | |
// TODO: log error | |
} | |
return ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment