From the 1.4M1 release notes: "to make Swift code ...
# multiplatform
From the 1.4M1 release notes: "to make Swift code aware of expected exceptions, Kotlin functions should be marked with a @Throws annotation specifying a list of potential exception classes." Does this include runtime exceptions? E.g. IllegalStateException?
doesn't fall into the "expected exceptions" to me. If you don't declare a thrown exception, the app will crash. If the exception is likely to happen, you'll want to declare it, otherwise, if it's something normally impossible and it is okay to crash because it'd be an unrecoverable programmer error, then you can not declare it.
đź‘Ť 1
Let’s talk kotlinx.serialization. Errors while decoding JSON are expected IMO, although they are runtime exceptions, hence can’t be used with
. Thoughts?
I wonder what’s the best practice here.
I think you can still declare
and subclasses in
. Otherwise, you can catch it a rethrow it wrapped in a non
, or return an error type.