NetworkError
public struct NetworkError : Swift.Error, CustomStringConvertible
Swift.Error
struct representing networking errro within EPI Networking context.
-
The error message.
This aims to be descriptive message of an issue that caused the error.
Declaration
Swift
public let message: String
-
The status of the network error.
Declaration
Swift
public let status: NetworkErrorStatus
-
The JSON payload associated with the error, if available.
Declaration
Swift
public let jsonPayload: Any?
-
A textual representation of the error.
Declaration
Swift
public var description: String { get }
-
The error description.
Declaration
Swift
public var errorDescription: String? { get }
-
The localized error description.
Declaration
Swift
public var localizedDescription: String { get }
-
Initializes a new
NetworkError
instance.Declaration
Swift
public init(message: String, status: NetworkErrorStatus, jsonPayload: Any?)
Parameters
message
The error message.
status
The status of the network error.
jsonPayload
The JSON payload associated with the error, if available.
-
Decodes the error payload to a specified error model type.
Declaration
Swift
public func decodedErrorPayload<ErrorModel>() -> ErrorModel? where ErrorModel : Decodable
Return Value
An instance of the specified error model type if the JSON payload can be decoded successfully, otherwise
nil
.