# NSError class documentation

rfm@gnu.org
Generated at 2025-02-13 06:02:40 +0000
2004,2006 Free Software Foundation, Inc.
Software documentation for the NSError class
Foundation/NSError.h
NSCopying
NSCoding
Error information class.
NSError instances are used to pass information about runtime errors from lower levels to higher levels of the program.
These should be used instead of exceptions where an error is caused by external factors (such as a resource file not being present) rather than a programming error (where NSException should be used).
errorWithDomain:
aDomain
code:
aCode
userInfo:
aDictionary
Creates and returns an autoreleased NSError instance by calling -initWithDomain:code:userInfo:
code
Return the error code... which is not globally unique, just unique for a particular domain.
domain
Return the domain for this instance.
initWithDomain:
aDomain
code:
aCode
userInfo:
aDictionary
Initialises the receiver using the supplied domain, code, and info.
The domain must be non-nil.
localizedDescription
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.
localizedFailureReason
Return a human readable explanation of the reason for the error (if known). This should normally be a more discursive explanation then the short one provided by the -localizedDescription method.
The default implementation uses the value from the user info dictionary if it is available, otherwise it returns `nil` .
localizedRecoveryOptions
Returns an array of strings to be used as titles of buttons in an alert panel when offering the user optionbs to try to recover from the error.
The default implementation uses the value from the user info dictionary if it is available, otherwise it returns `nil`.
localizedRecoverySuggestion
Returns a string used as the secondary text in an alert panel, suggesting how the user might select an option to attempt to recover from the error.
The default implementation uses the value from the user info dictionary if it is available, otherwise it returns `nil`.
recoveryAttempter
Not yet useful in GNUstep.
The default implementation uses the value from the user info dictionary if it is available, otherwise it returns `nil`.
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.