ErrorObject

class ErrorObject : NSError

Information about an error condition including a domain, a domain-specific error code, and application-specific information.

Objective-C methods can signal an error condition by returning an NSError object by reference, which provides additional information about the kind of error and any underlying cause, if one can be determined. An NSError object may also provide localized error descriptions suitable for display to the user in its user info dictionary. See Error Handling Programming Guide for more information.

  • Returns an NSError object initialized for a given error type.

    Declaration

    Swift

    required init(protocol: ErrorProtocol)

    Parameters

    type

    An error object type.

    comment

    The comment to place above the key-value pair in the strings file.

    Return Value

    An NSError object initialized for domain with the specified error code and the dictionary of arbitrary data userInfo.

  • Returns an NSError object initialized for a given code.

    Declaration

    Swift

    required init(code: Int, value: String)

    Parameters

    code

    The error code for the error.

    value

    The value to return if key is nil or if a localized string for key can’t be found in the table.

    comment

    The comment to place above the key-value pair in the strings file.

    Return Value

    An NSError object initialized for domain with the specified error code and the dictionary of arbitrary data userInfo.

  • Returns an object initialized from data in a given unarchiver.

    Declaration

    Swift

    required init?(coder aDecoder: NSCoder)

    Parameters

    aDecoder

    An unarchiver object.

    Return Value

    self, initialized using the data in decoder.