The `completionHandler` for `suspend` functions on...
# compose
b
The
completionHandler
for
suspend
functions only excepts an
Error
, but on the Kotlin side I want to catch a specific exception type e.g.
MyException
. How do I pass
MyException
to the
completionHandler
?
z
Did you mean to post this in #coroutines ?
Which completion handler are you talking about?
b
I'm using coroutines but this issue is not specific to coroutines in any way. When you write this in Kotlin:
Copy code
@Throws(MyException::class)
suspend fun myFunction(): Boolean
Then on the Swift/ObjC side, the function gets defined as
completionHandler(KotlinBoolean?, NSError?)
, so I'm not sure how to pass MyException over.
I ended up just changing my return type instead of dealing with it (so my return type now includes the error cases as well). I think what I'm asking for is just not supported by ObjC interop 🤷
Oh, but I did mean to post this in #ios, whoops
z
ah, yea i know nothing about obj-c integration 😅