In future, could Kotlin have checked exceptions?

Actually I don’t know, what exception (and with what text, inner exceptions, etc.) will be thrown. And sometimes I need to parse exception text to determine real case (and, unfortunately, I have to write tests to verify this).

So in real life code can throw CancellationException, because of timeout or because of client close. And I have to determine this (please note, that type is exact the same).

Therefore I have DMZ-like layer to split scenarios to useful for me. For example, code above doesn’t know to differ TCP-like errors and TLS-like ones. All of them are “network-related”. And because of all these facts I advice writing intermediate code between library and your system. So you will be on the safe side in your code, and you will able to cover everything useful in this layer.