Class

NSException

NSException is used to implement exception handling and contains information about an exception. An exception is a special condition that interrupts the normal flow of program execution. Each application can interrupt the program for different reasons. For example, one application might interpret saving a file in a directory that is write-protected as an exception. In this sense, the exception is equivalent to an error. Another application might interpret the user’s key-press (for example, Control-C) as an exception: an indication that a long-running process should be aborted.

Symbols

Creating and Raising an NSException Object

class func raise(NSException​Name, format:​ String, arguments:​ CVa​List​Pointer)

Creates and raises an exception with the specified name, reason, and arguments.

func raise()

Raises the receiver, causing program flow to jump to the local exception handler.

Querying an NSException Object

var name:​ NSException​Name

A string used to uniquely identify the receiver.

var reason:​ String?

A string containing a “human-readable” reason for the receiver.

var user​Info:​ [Any​Hashable :​ Any]?

A dictionary containing application-specific data pertaining to the receiver.

Getting Exception Stack Frames

var call​Stack​Return​Addresses:​ [NSNumber]

The call return addresses related to a raised exception.

var call​Stack​Symbols:​ [String]

An array containing the current call stack symbols.

Relationships

Inherits From