Table of Contents Previous Section
Raising an Exception
Once an exception is detected, it must be propagated to code that will handle it, called the exception handler. This entire process of handling an exception is referred to as "raising an exception." Exceptions are raised by instantiating an NSException object and sending it a raise message.NSException objects provide:
- a name - a short string that is used to uniquely identify the exception.
- a reason - a longer string that contains a "human-readable" reason for the exception.
- userInfo - a dictionary used to supply application-specific data to the exception handler. For example, if the return value of a method causes an exception to be raised, you could pass the return value to the exception handler through userInfo.
Table of Contents Next Section