APIError
public enum APIError : Swift.Error
extension APIError: LocalizedError
extension APIError: ErrorConvertible, ErrorWithCause
An error from data store
-
Indicates that JSON data for one page is not decodable.
Declaration
Swift
case jsonMappingFailed(JSON, Any.Type)
-
Indicates that JSON data have incoherence and records could not be decoded.
Declaration
Swift
case recordsDecodingFailed(JSON, ImportableParser.Error)
-
Indicates a response failed due to an underlying
Error
.Declaration
Swift
case request(Swift.Error)
-
Indicates a json decoding process due to an underlying
Error
.Declaration
Swift
case jsonDecodingFailed(Swift.Error)
-
Indicates a string decoding process due to an underlying
Error
.Declaration
Swift
case stringDecodingFailed(Swift.Error)
-
Return true if error correspond to the pass HTTP code.
Declaration
Swift
public func isHTTPResponseWith(code: HTTPCode) -> Bool
-
Return true if error correospond to one of passed HTTP codes.
Declaration
Swift
public func isHTTPResponseWith(codes: [HTTPCode]) -> Bool
-
Return
true
if one of underlying error is anURLError
.Declaration
Swift
public var isUrlError: Bool { get }
-
Return the underlying error if its an
URLError
.Declaration
Swift
public var urlError: URLError? { get }
-
Check if contains the specifyed error code.
Declaration
Swift
public func isUrlError(with code: URLError.Code) -> Bool
Parameters
code
the code
Return Value
true
if this error contains the code. -
Check if contains the specifyed one the specifyed error code.
Declaration
Swift
public func isUrlError(with codes: [URLError.Code]) -> Bool
Parameters
codes
the codes to check
Return Value
true
if this error contains one of the codes. -
Is
.timedOut
error.Declaration
Swift
public var isTimedOut: Bool { get }
-
Is
.cannotConnectToHost
error.Declaration
Swift
public var isCannotConnectToHost: Bool { get }
-
Is
.notConnectedToInternet
error.Declaration
Swift
public var isNotConnectedToInternet: Bool { get }
-
Is
.cancelled
error.Declaration
Swift
public var isCancelled: Bool { get }
-
Is
.userAuthenticationRequired
error.Declaration
Swift
public var isUserAuthenticationRequired: Bool { get }
-
Undocumented
See moreDeclaration
Swift
public enum RequestCase : String
-
Check if this error match the request case.
Declaration
Swift
public func isRequestCase(_ case: RequestCase) -> Bool
Parameters
case
the request case to check
Return Value
true
if error match the request case -
the underlying request case if any.
Declaration
Swift
public var requestCase: RequestCase? { get }
-
The localized error description.
Declaration
Swift
public var errorDescription: String? { get }
-
Declaration
Swift
public var failureReason: String? { get }
-
Declaration
Swift
public var recoverySuggestion: String? { get }
-
Declaration
Swift
public var helpAnchor: String? { get }
-
Undocumented
Declaration
Swift
public static func error(from underlying: Swift.Error) -> APIError
-
The underlying error if any.
Declaration
Swift
public var error: Swift.Error? { get }
-
The underlying response if any.
Declaration
Swift
public var response: Response? { get }
-
The underlying
MoyaError
from Moya api if any.Declaration
Swift
public var moyaError: MoyaError? { get }
-
The underlying
AFError
from Alamofire if any.Declaration
Swift
public var afError: AFError? { get }
-
The underlying url if any.
Declaration
Swift
public var url: URL? { get }
-
The underlying url as url convertible if any.
Declaration
Swift
public var urlConvertible: URLConvertible? { get }
-
The server response as string if any.
Declaration
Swift
public var responseString: String? { get }
-
Create
APIError
fromMoyaError
Declaration
Swift
public static func moya(_ moyaError: MoyaError) -> APIError
-
true
if there is rest errors. If you need to know that and userestErrors
, prefer userestErrors
directly.Declaration
Swift
public var isRestError: Bool { get }
-
Get
RestErrors
from this error data.Declaration
Swift
public var restErrors: RestErrors? { get }
-
Check if match rest error code.
Declaration
Swift
public func match(_ code: RestErrorCode) -> Bool
Parameters
code
the code to chec;
Return Value
true
if match