Kelvin Law
06/19/2020, 12:52 PMThrowable instead of `Exception`Does anyone know why runCatching for kotlin.Result is catching Throwable instead of Exception?
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.htmlelizarov
06/19/2020, 3:26 PMThrowable or Exception is something to be avoided in general code. If you have to catch, then it should be limited to the most specific type. runCatching on the other side, has completely different use-cases well documented here: https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/result.mdelizarov
06/19/2020, 3:27 PMException instead of Throwable as a mistake novice programmers make in those rare cases when catching everything was indeed called for by the business logic of the code (some top-level code that has to log all exceptions due to counter-inituituive naming has to actually catch all Throwable types)Kelvin Law
06/20/2020, 9:28 AM