Class: NSError
Overview
An NSError object encapsulates richer and more extensible error information than is possible using only an error code or error string. The core attributes of an NSError object are an error domain (represented by a string), a domain-specific error code and a user info dictionary containing application specific information.
Class Method Summary (collapse)
-
+ errorWithDomain:code:userInfo:
Creates and initializes an NSError object for a given domain and code with a given userInfo dictionary.
Instance Method Summary (collapse)
-
- code
Returns the receiver’s error code.
-
- domain
Returns the receiver’s error domain.
-
- helpAnchor
A string to display in response to an alert panel help anchor button being pressed.
-
- initWithDomain:code:userInfo:
Returns an NSError object initialized for a given domain and code with a given userInfo dictionary.
-
- localizedDescription
Returns a string containing the localized description of the error.
-
- localizedFailureReason
Returns a string containing the localized explanation of the reason for the error.
-
- localizedRecoveryOptions
Returns an array containing the localized titles of buttons appropriate for displaying in an alert panel.
-
- localizedRecoverySuggestion
Returns a string containing the localized recovery suggestion for the error.
-
- recoveryAttempter
Returns an object that conforms to the NSErrorRecoveryAttempting informal protocol.
-
- userInfo
Returns the receiver's user info dictionary.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
Instance Method Details
- (Integer) code
Returns the receiver’s error code. Note that errors are domain specific.
- (String) domain
Returns the receiver’s error domain.
- (String) helpAnchor
A string to display in response to an alert panel help anchor button being pressed. If this method returns a non-nil value for an error being presented by alertWithError:, the alert panel will include a help anchor button that can display this string.The best way to get a value to return for this method is to specify it as the value of NSHelpAnchorErrorKey in the NSError object’s userInfo dictionary; or the method can be overridden.
- (Object) initWithDomain(domain, code:code, userInfo:dict)
- (String) localizedDescription
Returns a string containing the localized description of the error. This method can be overridden by subclasses to present customized error strings.
- (String) localizedFailureReason
Returns a string containing the localized explanation of the reason for the error. This method can be overridden by subclasses to present customized error strings.
- (Array) localizedRecoveryOptions
Returns an array containing the localized titles of buttons appropriate for displaying in an alert panel. The first string is the title of the right-most and default button, the second the one to the left of that, and so on. The recovery options should be appropriate for the recovery suggestion returned by localizedRecoverySuggestion. If the user info dictionary doesn’t contain a value for NSLocalizedRecoveryOptionsErrorKey, only an OK button is displayed.This method can be overridden by subclasses to present customized recovery suggestion strings.
- (String) localizedRecoverySuggestion
Returns a string containing the localized recovery suggestion for the error. The returned string is suitable for displaying as the secondary message in an alert panel. This method can be overridden by subclasses to present customized recovery suggestion strings.
- (Object) recoveryAttempter
Returns an object that conforms to the NSErrorRecoveryAttempting informal protocol. The recovery attempter must be an object that can correctly interpret an index into the array returned by localizedRecoveryOptions.
- (Hash) userInfo
Returns the receiver's user info dictionary.