George
01/03/2023, 10:42 AMrunCatching()
does not catch Exception
instead of Throwable
? Shouldn't we always let errors such as StackOverflow
be thrown ?phldavies
01/03/2023, 11:09 AMkotlin.Result
class for a better understanding. https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/result.mdphldavies
01/03/2023, 11:12 AMResult
class was primarily added to support the Continuation
callback interface (which needed to accept any failure to resume with) - it really should be avoided for use in “normal” code in favour of domain-specific types, and/or try/catch with explicit catches. runCatching
catching Throwable is indeed something to be cautious of as it will inevitably trip you up in the future.