PKError
public protocol PKError : CustomStringConvertible, Error
-
The error domain (used for creating
NSError
)Declaration
Swift
static var domain: String { get }
-
The error code. use
switch self
to retrieve the value in enums.var code: Int { switch self { case .one: return 1 case .two: return 2 } }
Declaration
Swift
var code: Int { get }
-
The error description.
Declaration
Swift
var errorDescription: String { get }
-
Dictionary object to hold all params of the case.
Should take all associated values and create a dictionary for them.
For example in enum error when we have 2 cases:
- .one(error: NSError, url: URL)
- .two(error: NSError))
var userInfo: [String : Any] { switch self { case .one(let rootError, let url): return ["root": rootError, "url": url] case .two(let rootError): return ["root": rootError] } }
Declaration
Swift
var userInfo: [String : Any] { get }
-
asNSError
Default implementationcreates an
NSError
from the selected case.Default Implementation
creates an
NSError
from the selected case.Declaration
Swift
var asNSError: NSError { get }
-
description
Extension methoddescription string
Declaration
Swift
public var description: String { get }
-
description
Extension methodDeclaration
Swift
var description: String { get }