nullable
Runner that catches and normalizes all thrown exceptions into a null value.
Will catch CancellationException! In a
suspendcontext, use nullableOf instead.Does NOT catch Error subclasses. Errors should be fatal.
val a: String? = nullable { throw Exception() } // == null
val b: String? = nullable { "Hello, World!" } // == "Hello, World!"Content copied to clipboard
Shorthand for try { block() } catch (_: Exception) { null }.