# ktor


02/14/2021, 1:39 PM
I'm using Ktor in a multiplatform project (Android + iOS) and I'm running into an issue with iOS where exceptions are not delivered the generated callback handler (callback handler accepts both an object and error), but instead uncaught and crashes the app. This is the error message that gets printed right before the stacktrace:
Copy code
Exception doesn't match @Throws-specified class list and thus isn't propagated from Kotlin to Objective-C/Swift as NSError
I've determined this happens because, in Kotlin, it's not required to specify if a function throws an exception. However, when targeting a native platform, if you don't specify that the function throws, those errors will be uncaught. So what I'm doing to resolve this is to add
to every single API function I have. I'm wondering if there is an easier way to manage this since there's no lint type check for this (that I'm aware of), making it's easy to forget. I also feel like this may be more of a Kotlin question than a Ktor one.

Michal Klimczak

02/14/2021, 2:10 PM
This is exactly how you handle kotlin exceptions in ios, not specific to ktor.