4 ms·
Does the compiler catch calls to throwing functions from non-throwing functions yet? That’s been a huge problem for us: Some lib/func 16 layers deep throws an
by newZWhoDis 2y ago
Does the compiler catch calls to throwing functions from non-throwing functions yet?
That’s been a huge problem for us: Some lib/func 16 layers deep throws an exception and it’s wrapped in a non-throwing function so the higher-level caller has no idea the call can generate an exception and runtime crash the whole app.
- dtech 2y agoNo, and it won't. Checked exceptions were explicitly removed compared to Java, and most people view them as a mistake (including the Java 8+ ecosystem e.g. streams). Try is a bit better and Kotlin has a bit of that with Result + runCatching. You can find a pretty good overview of the Kotlin error handling phylosphy here [1] [1] https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/result.md#error-handling-style-and-exceptions https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/...
- jmaker 2y agoAlso, Arrow.kt is worth mentioning for functional error handling.