David Bieregger
06/22/2022, 3:57 PMtry {
throw Error("Oh no!")
} catch {
console.log("Something bad happened, but don't know what")
}
var result = try throw Error("Oh no!") catch console.log("Something bad happened")
Zac Sweers
06/22/2022, 3:59 PM(_: Throwable)
. And also a compiler thing rather than stdlibdmitriy.novozhilov
06/22/2022, 4:00 PMDavid Bieregger
06/22/2022, 4:00 PMDavid Bieregger
06/22/2022, 4:01 PMdmitriy.novozhilov
06/22/2022, 4:04 PMJavier
06/22/2022, 5:41 PMval foo = runCatching { bar() }.getOrNull()
elizarov
06/22/2022, 7:03 PMephemient
06/22/2022, 7:34 PMcatching
from https://youtrack.jetbrains.com/issue/KT-7128/Multi-catch-block may work out since it does limit the type of exception being caught, although it would be convenient if builder inference could infer the exception type without needing to specify it explicitly in the case of .catching { handle(it) }