runUiCatching

inline fun <T : Exception> runUiCatching(crossinline onFailure: (T) -> Unit = { Log.err("Failure in runUiCatching", it) }, crossinline block: () -> Unit)

Runs the specified function on the ui thread and catches any exceptions.