APIError

open class APIError : LocalizedError, ErrorSerializable, DownloadErrorSerializable

APIError is used as a generic wrapper for all kinds of API errors.

  • URLRequest that was unsuccessful

    Declaration

    Swift

    public let request: URLRequest?
  • Response received from web service

    Declaration

    Swift

    public let response: HTTPURLResponse?
  • Data, contained in response. Nil, if this error is coming from a download request.

    Declaration

    Swift

    public let data: Data?
  • Downloaded fileURL. Nil, if used with upload or data requests.

    Declaration

    Swift

    public let fileURL: URL?
  • Error instance, created by Foundation Loading System or Alamofire.

    Declaration

    Swift

    public let error: Error?
  • Undocumented

    Declaration

    Swift

    required public init(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?)
  • Undocumented

    Declaration

    Swift

    required public init(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?)
  • Prints localized description of error inside

    Declaration

    Swift

    open var errorDescription: String? { get }
  • Whether the request, that led to this error, was cancelled by the sender

    Declaration

    Swift

    open var isCancelled: Bool { get }