Create an expect Exception. Then typealias it for JVM and declare it for the other platforms.
This is how Kotlin standard lib did it for IllegalArgumentException and IllegalStateException
👍 1
mkrussel
04/12/2021, 1:44 PM
You might need to also declare the parent exceptions.
b
bsimmons
04/12/2021, 1:54 PM
Interesting. I'm not exactly sure how to setup the expect/actual. Something like this?
Copy code
expect class VpnException: Exception
actual class VpnException: javax.net.ssl.SSLPeerUnverifiedException()
bsimmons
04/12/2021, 1:54 PM
The compiler doesn't seem to like that.
m
mkrussel
04/12/2021, 1:55 PM
public expect class IOException(message: String, cause: Throwable? = null) : Exception
public actual typealias IOException = IOException
mkrussel
04/12/2021, 1:55 PM
That's what I did for IOException, make sure the actual part imports IOException to make it work correclty