DarkMatterError
@objc public class DarkMatterError: NSObject, Error
A class representing a DarkMatter error.
-
The error message.
Declaration
Swift
public var message: String? = nil -
The error code.
Declaration
Swift
public var code: Int = DarkMatterErrorCode.NoError.rawValue -
Data associated with the error.
Declaration
Swift
public var data: [String: Any]? = nil -
HTTP headers associated with the error.
Declaration
Swift
public var headers: [String: String]? = nil -
Predefined errors that can be registered with the
DarkMatterErrorService.Declaration
Swift
public static let _dmErrors: [String: ErrorData] = [ -
Initializes the instance with default values.
Declaration
Swift
public override init() -
Initializes the instance with values from an Alamofire HTTP
DataResponseobject.Declaration
Swift
public init(response: DataResponse<Any>) -
Initializes the instance with the given error code.
Declaration
Swift
public convenience init(code: Int)Parameters
codeThe error code.
-
Initializes the instance with the given error code and message.
Declaration
Swift
public convenience init(code: Int, message: String)Parameters
codeThe error code.
messageThe error message.
-
Initializes the instance with the given error code, message, and data.
Declaration
Swift
public convenience init(code: Int, message: String, data: [String: Any]?)Parameters
codeThe error code.
messageThe error message.
dataThe associated data.
-
Initializes the instance with the given values.
Declaration
Swift
public init(code: Int, message: String, data: [String: Any]?, headers: [String: String]?)Parameters
codeThe error code.
messageThe error message.
dataThe associated data.
headersThe associated HTTP headers.
-
Converts a
DarkMatterErrorCodeto a V5 server error code.Declaration
Swift
public static func getServerCodeForError(error: DarkMatterErrorCode) -> IntParameters
errorThe dark matter error code.
Return Value
The V5 server error code corresponding to the dark matter error.
-
Converts a V5 server error code to a
DarkMatterErrorCode.Declaration
Swift
public static func getErrorForCode(_ code: Int) -> DarkMatterErrorCodeParameters
codeV5 server error code.
Return Value
The corresponding
DarkMatterErrorCode. -
Used to determine if a network request should be retried based on the status code.
Declaration
Swift
public static func shouldRetry(code: Int) -> BoolParameters
codeThe HTTP status code.
Return Value
trueif the network request should be retried. -
Returns a string that represents the code and message of the
DarkMatterErrorclass.Declaration
Swift
public override var description: String -
Creates a verbose string description of the
DarkMatterErrorclass.Declaration
Swift
public func toStringVerbose() -> StringReturn Value
A string that is the
descriptionwith the data and headers appended to it.
DarkMatterError Class Reference