Philipp Bykow
01/25/2022, 2:36 PMFunction doesn't have or inherit @Throws annotation and thus exception isn't propagated from Kotlin to Objective-C/Swift as NSError.
and crashes the App. In the class init we call something like this
coroutineScope.launch {
test()
}
The test function is as followed:
@Throws(Exception::class)
private suspend fun test() {
...
}
kpgalligan
01/25/2022, 5:04 PMcoroutineScope.launch
from Swift is failing. It’s probably wrapping and throwing whatever test()
throws.coroutineScope.launch
call with try/catch, print that stack trace, then rethrow.@Throws
if you want to bubble errors up to Swift. However, you’ll need to use explicit try
calls from Swift. Exceptions in that context are very different. We basically don’t use @Throws
Philipp Bykow
01/26/2022, 12:11 PM