When you send a presentError: or presentError:modalForWindow:delegate:didPresentSelector:contextInfo: message to certain eligible objects, the message travels up a sequence of objects in an application called the error-responder chain (see “The Error-Responder Chain”). The default implementation for most objects in this chain is to send the willPresentError: method to self before sending the presentError: message to the next object. The willPresentError: message gives instances of custom subclasses an opportunity to look at the error object being passed up the chain and possibly customize it. When the error object reaches the end of the chain, the global application object, NSApp, displays an error alert to users; but before NSApp displays the error alert, it invokes the method application:willPresentError:, giving its delegate the same opportunity.
The following sections discuss strategies for implementing the willPresentError: and application:willPresentError: methods.
Passing Errors Up the Error-Responder Chain
Customizing an Error Object
Last updated: 2006-10-03