Skip to content

Instantly share code, notes, and snippets.

View Francescu's full-sized avatar

Francescu Santoni Francescu

View GitHub Profile
inline fun <T>tryOrNull(action: () -> T): T? {
var ret: T?
try {
ret = action()
} catch (e: Exception) {
ret = null
// TODO: log error
}
return ret
}