Is there a built in way to convert a `Throwable` i...
# multiplatform
r
Is there a built in way to convert a
Throwable
into a
NSError
or
NSException
?
r
I don’t see anything related to what I asked
t
So if Swift or Objective-C code calls a Kotlin method which throws an exception to be handled, then the Kotlin method should be marked with a @Throws annotation. In this case all Kotlin exceptions (except for instances of Error, RuntimeException and subclasses) are translated into a Swift error/NSError.
The interoperability should handle that for you.
r
Not really, I just have a function that has a
Throwable
parameter and calls a function taking a
NSError
. I’m not talking about automatic thrown error translation
s
Still an open question.
m
I also like to hear the answer