Exception
open class Exception : Error, CustomStringConvertible
An error that can be thrown. Encapsulates the type of error, the description, and any additional metadata.
-
The error that caused the exception.
Declaration
Swift
public let error: Error
-
A description of the exception, or nil if none exists.
Declaration
Swift
public let message: String?
-
The call stack at the time the exception was thrown.
Declaration
Swift
public let stackTrace: [String]
-
Declaration
Swift
public var description: String { get }
-
Initializes an Exception instance.
Declaration
Swift
public init(error:Error, message:String?, stackTrace:[String]? = nil)
Parameters
error
The error causing the exception.
message
A human-readable message explaining the error.
stackTrace
The stack trace at the time the exception was thrown. Defaults to
Thread.callStackSymbols
. -
The components of the description of this exception. Subclasses should override this method to return custom information in the description. Subclasses should prepend the superclass’ implementation to their return value.
Declaration
Swift
open func descriptionComponents() -> [String]