Venkataramanan Parameswaran08/17/2022, 5:03 PM
mkrussel08/17/2022, 5:13 PM
it can contain that. Otherwise it will only be the CancelationException. I’m not sure how that would trigger, since it doesn’t seem like there is anything that could cancel it. Only thing I can thing of is awaiting on an async from another scope and that scope was canceled or the async itself was canceled.
Venkataramanan Parameswaran08/17/2022, 5:16 PM
but what is the use of this annotation here...?
mkrussel08/17/2022, 5:53 PM
Rick Clephas08/17/2022, 7:42 PM
annotation are passed to ObjC/Swift. Any other exception will terminate the program. This behaviour is explained in more detail in the docs. Without the
annotation you’ll likely never receive an error since you can’t cancel the suspend function from Swift. Though you will receive `CancelationException`s thrown by e.g.
. FYI if you want more control over your suspend functions you should instead use some kind of wrapper function that exposes an option to cancel the function. Or use a library that does this for you. Like the one I developed: https://github.com/rickclephas/KMP-NativeCoroutines