Swift run time exception like NSSetUncaughtExceptionHandler

Hi Team,

Would like to handle swift run time errors like EXC_BAD_INSTRUCTION with common exception handler like NSSetUncaughtExceptionHandler.

Could not find any such interface to register for generic exceptions.

 

Also tried below for registering for objective c exceptions:

 

NSSetUncaughtExceptionHandler { exception in

print(exception.callStackSymbols)

}

and this is not being invoked for Swift exception like

let test:String? = nil

let throwsException = test!

 

Is there a generic exception handler that we could extend or register our own exception handler in Swift?

Thanks in Advance!

Powered by WPeMatico

About

You may also like...

Comments are closed.