Up

NSError class documentation

Authors

Richard Frith-Macdonald (rfm@gnu.org)

Copyright: (C) 2004 Free Software Foundation, Inc.

Software documentation for the NSError class

NSError : NSObject

Declared in:
Foundation/NSError.h
Conforms to:
NSCopying
NSCoding
Standards:

Error information class

Method summary

errorWithDomain: code: userInfo: 

+ (id) errorWithDomain: (NSString*)aDomain code: (int)aCode userInfo: (NSDictionary*)aDictionary;

Creates and returns an autoreleased NSError instance by calling -initWithDomain:code:userInfo:


code 

- (int) code;

Return the error code... which is not globally unique, just unique for a particular domain.


domain 

- (NSString*) domain;

Return the domain for this instance.


initWithDomain: code: userInfo: 

- (id) initWithDomain: (NSString*)aDomain code: (int)aCode userInfo: (NSDictionary*)aDictionary;
This is a designated initialiser for the class.

Initialises the receiver using the supplied domain, code, and info.
The domain musat be non-nil.


localizedDescription 

- (NSString*) localizedDescription;
Subclasses should override this method.

Return a human readable description for the error.
The default implementation uses the value from the user info dictionary if it is available, otherwise it generates a generic one from domain and code.


userInfo 

- (NSDictionary*) userInfo;

Return the user info for this instance (or nil if none is set)
The NSLocalizedDescriptionKey should locate a human readable description in the dictionary.
The NSUnderlyingErrorKey key should locate an NSError instance if an error is available describing any underlying problem.



Up