< Previous PageNext Page > Hide TOC

Uncaught Exceptions

If an exception is not caught, it is intercepted by a function called the uncaught exception handler. The uncaught exception handler always causes the program to exit but may perform some task before this happens.

The default uncaught exception handler logs a message to the console before it exits the program. If the application was launched from the shell, the log messages are sent to the Terminal window.

You can set a custom function as the uncaught exception handler using the NSSetUncaughtExceptionHandler function; you can obtain the current uncaught exception handler with the NSGetUncaughtExceptionHandler function.

Note: Exceptions on the main thread of a Cocoa application do not typically rise to the level of the uncaught exception handler because NSApplication catches all such exceptions.



< Previous PageNext Page > Hide TOC


© 2002, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-02)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.