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
Availability: MacOS-X 10.0.0

Error information class.
Method summary

errorWithDomain: code: userInfo: 

+ (id) errorWithDomain: (NSString*)aDomain code: (int)aCode userInfo: (NSDictionary*)aDictionary;
Availability: MacOS-X 10.0.0

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

code 

- (int) code;
Availability: MacOS-X 10.0.0

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

domain 

- (NSString*) domain;
Availability: MacOS-X 10.0.0

Return the domain for this instance.

initWithDomain: code: userInfo: 

- (id) initWithDomain: (NSString*)aDomain code: (int)aCode userInfo: (NSDictionary*)aDictionary;
Availability: MacOS-X 10.0.0

This is a designated initialiser for the class.
Initialises the receiver using the supplied domain, code, and info.
The domain must be non-nil.

localizedDescription 

- (NSString*) localizedDescription;
Availability: MacOS-X 10.0.0

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;
Availability: MacOS-X 10.0.0

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