Hello, I’m trying to do a kotlin multiplatform app...
# kotlin-native
s
Hello, I’m trying to do a kotlin multiplatform app, and I’m using ktor for network calls, but when I do a network call that fails on iOS, it crashes the app. The stack trace says that I should add the @Throws annotation I tried to add it as described here https://github.com/JetBrains/kotlin-native/issues/2122 and when I try to add it it as shown here
Copy code
actual typealias Throws = kotlin.native.Throws
and try to compile it gives me this error
Copy code
Right-hand side of actual type alias should be a class, not another type alias
a
AFAIK, there was a change made in 1.4, please see details here.
b
Just typealias to direct class that native @throws typealiases
r
kotlin.Throws
exists in common in 1.4 so you shouldn’t need to do your own expect/actual or typealias anything.
s
Oh, cool. I’ll try that now!
Okay, just following up, and it looks like I just needed to do like @russhwolf said and use
@kotlin.Throws
then everything works