In Xcode I can create a breakpoint to catch all exceptions (exception breakpoint). However this breakpoint will also fire in a try-catch situation.
I’m using third party libraries, so the try-catch situation is a fact, not an option.
Is there a way to only handle the uncaught exceptions, instead of all exceptions?
You can put a top-level
try/catchat your threads’ entries.You may also be interested in
NSSetUncaughtExceptionHandler.Normally, top level handlers are of little utility in production (you’re really not attempting to recover from a problem you aren’t prepared to handle, but it may be useful for last words or breakpoints). Ideally, you would guard your exits from those library interfaces with a try/catch if and only if you could handle the the exception. Either that, or
nothrowas a quick debugging utility during development.If you’re trying to catch Cocoa exceptions — just let it die and file bugs to whoever thought Cocoa exceptions were supposed to be recoverable.