williamFalcon / SwiftTryCatch

Adds try-catch support for Swift
MIT License
140 stars 58 forks source link

Not able to catch exception in Xcode 9.4 and swift 4 #18

Open raj-qt opened 6 years ago

raj-qt commented 6 years ago

Hi, I am using the code to handle swift exception but unfortunately its not woking.

Here is the code i am trying.

var array = [String] (); SwiftTryCatch.try({ var val = array[40] }, catch: { (error) in // code to handle exception print("in catch") }, finallyRun: { // code to do any way print("in finally") })

Its just crashing on line var val = array[40] and not catch the exception in catch clause

Can anyone help me please?

fukemy commented 6 years ago

any ideal? same problem here, exception belong to runtime exception can not catched

dfed commented 4 years ago

This is a Swift runtime crash rather than a thrown Objective-C exception. I don't believe this project can be used how you're using it.