I'm working on an engineering app that uses a bunch of java code I succefully converted using J2OBJC. Amazing! I can call the functions defined in that java code from my Swift code and it works nicely most of the time.
But that java code throws an "OutOfRangeException" whenever the user input paramaters fall out of some range. The error ends up in my AppDelegate and crashes my app there.
Is there a way to catch this "exception" gracefully without crashing?
I've tried the following but it doesn't work, as Xcode warns:
do { 'catch' block is unreachable because no errors are thrown in 'do' block
let myVar = JavaProject().someFunction(with: Temp)
} catch {
}
*** Terminating app due to uncaught exception 'OutOfRangeException', reason: 'JavaProject.OutOfRangeException'