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. On OS X, 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.