Closed robbiehanson closed 1 year ago
Have you tried annotating cborDeserialize
with @Throws
? It should automatically convert any annotated exception to a NSError
.
See https://kotlinlang.org/docs/native-objc-interop.html#errors-and-exceptions
Good idea. I think that actually works better. So I've adopted that approach in the most recent commit.
Force-pushed because I forgot to sign the first 3 commits. So I went ahead and rebased on master too.
The problem is that an exception thrown in Kotlin isn't caught in Swift:
Instead the app will simply crash. So the solution, for now, is to have the Kotlin function use a try/catch, and change the return type to an optional: