NSException

NSException Mac OS X 10.0

This class implements the Foundation framework's exception-handling system. Exceptions are used in Cocoa as a mechanism to deal with special conditions in the execution of a program that may require special handling. Clients can use NSException objects to raise exceptions (creating a special condition), as well as to retrieve information about an exception. For details on exception handling, see Chapter 2.

figs/cocn_1337.gif

@interface NSException : NSObject <NSCoding, NSCopying>
 // Convenience Constructors
   + (NSException *)exceptionWithName:(NSString *)name reason:(NSString *)reason userInfo:(NSDictionary *)userInfo;
 // Initializers
   - (id)initWithName:(NSString *)aName reason:(NSString *)aReason userInfo:(NSDictionary *)aUserInfo;
 // Class Methods
   + (void)raise:(NSString *)name format:(NSString *)format arguments:(va_list)argList;
   + (void)raise:(NSString *)name format:(NSString *)format, ...;
 // Instance Methods
   - (NSString *)name;
   - (void)raise;
   - (NSString *)reason;
   - (NSDictionary *)userInfo;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes