Important: The information in this document is obsolete and should not be used for new development.
MyExceptionProc
You provide theMyExceptionProc
function (an exception procedure) to handle errors that occur when operating on a collection object.
OSErr MyExceptionProc(Collection target, OSErr whichErr);
target
- A reference to the collection object for which the error occurred.
whichErr
- The result code associated with the error that occurred.
DESCRIPTION
You create this function to install in a collection object using theSetCollectionExceptionProc
function. Subsequently, whenever the Collection Manager is operating on that collection object and an error occurs, the Collection Manager calls this function, sending it a reference to the collection for which the error occurred and the result code associated with the error. You can use this information to handle the error appropriately for your application.You can use an exception procedure to respond to an error in a number of ways:
- You can change the error from one result code to another by returning as the function result the new result code.
- You can handle the error and return the
noErr
error code, which indicates that the Collection Manager should return control to the place in your application that generated the error, as if no error had occurred.- You can use the ANSI C functions
setjmp
andlongjmp
to jump out of the exception procedure into code to handle the error.
SEE ALSO
For an example of an exception procedure see "Installing an Exception Procedure" beginning on page 5-45.To install an exception procedure in a collection object, use the
SetCollectionExceptionProc
function, which is described on page 5-59.To obtain a pointer to an existing exception procedure in a collection object, use the
GetCollectionExceptionProc
function, which is described on page 5-58.