Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

AFError

mattt edited this page Sep 18, 2020 · 4 revisions

AFError

AFError is the error type returned by Alamofire. It encompasses a few different types of errors, each with their own associated reasons.

public enum AFError

Inheritance

Error, LocalizedError

Enumeration Cases

createUploadableFailed

UploadableConvertible threw an error in createUploadable().

case createUploadableFailed(error:​ Error)

createURLRequestFailed

URLRequestConvertible threw an error in asURLRequest().

case createURLRequestFailed(error:​ Error)

downloadedFileMoveFailed

SessionDelegate threw an error while attempting to move downloaded file to destination URL.

case downloadedFileMoveFailed(error:​ Error, source:​ URL, destination:​ URL)

explicitlyCancelled

Request was explicitly cancelled.

case explicitlyCancelled

invalidURL

URLConvertible type failed to create a valid URL.

case invalidURL(url:​ URLConvertible)

multipartEncodingFailed

Multipart form encoding failed.

case multipartEncodingFailed(reason:​ MultipartEncodingFailureReason)

parameterEncodingFailed

ParameterEncoding threw an error during the encoding process.

case parameterEncodingFailed(reason:​ ParameterEncodingFailureReason)

parameterEncoderFailed

ParameterEncoder threw an error while running the encoder.

case parameterEncoderFailed(reason:​ ParameterEncoderFailureReason)

requestAdaptationFailed

RequestAdapter threw an error during adaptation.

case requestAdaptationFailed(error:​ Error)

requestRetryFailed

RequestRetrier threw an error during the request retry process.

case requestRetryFailed(retryError:​ Error, originalError:​ Error)

responseValidationFailed

Response validation failed.

case responseValidationFailed(reason:​ ResponseValidationFailureReason)

responseSerializationFailed

Response serialization failed.

case responseSerializationFailed(reason:​ ResponseSerializationFailureReason)

serverTrustEvaluationFailed

ServerTrustEvaluating instance threw an error during trust evaluation.

case serverTrustEvaluationFailed(reason:​ ServerTrustFailureReason)

sessionDeinitialized

Session which issued the Request was deinitialized, most likely because its reference went out of scope.

case sessionDeinitialized

sessionInvalidated

Session was explicitly invalidated, possibly with the Error produced by the underlying URLSession.

case sessionInvalidated(error:​ Error?)

sessionTaskFailed

URLSessionTask completed with error.

case sessionTaskFailed(error:​ Error)

urlRequestValidationFailed

URLRequest failed validation.

case urlRequestValidationFailed(reason:​ URLRequestValidationFailureReason)

Properties

isSessionDeinitializedError

Returns whether the instance is .sessionDeinitialized.

var isSessionDeinitializedError:​ Bool

isSessionInvalidatedError

Returns whether the instance is .sessionInvalidated.

var isSessionInvalidatedError:​ Bool

isExplicitlyCancelledError

Returns whether the instance is .explicitlyCancelled.

var isExplicitlyCancelledError:​ Bool

isInvalidURLError

Returns whether the instance is .invalidURL.

var isInvalidURLError:​ Bool

isParameterEncodingError

Returns whether the instance is .parameterEncodingFailed. When true, the underlyingError property will contain the associated value.

var isParameterEncodingError:​ Bool

isParameterEncoderError

Returns whether the instance is .parameterEncoderFailed. When true, the underlyingError property will contain the associated value.

var isParameterEncoderError:​ Bool

isMultipartEncodingError

Returns whether the instance is .multipartEncodingFailed. When true, the url and underlyingError properties will contain the associated values.

var isMultipartEncodingError:​ Bool

isRequestAdaptationError

Returns whether the instance is .requestAdaptationFailed. When true, the underlyingError property will contain the associated value.

var isRequestAdaptationError:​ Bool

isResponseValidationError

Returns whether the instance is .responseValidationFailed. When true, the acceptableContentTypes, responseContentType, responseCode, and underlyingError properties will contain the associated values.

var isResponseValidationError:​ Bool

isResponseSerializationError

Returns whether the instance is .responseSerializationFailed. When true, the failedStringEncoding and underlyingError properties will contain the associated values.

var isResponseSerializationError:​ Bool

isServerTrustEvaluationError

Returns whether the instance is .serverTrustEvaluationFailed. When true, the underlyingError property will contain the associated value.

var isServerTrustEvaluationError:​ Bool

isRequestRetryError

Returns whether the instance is requestRetryFailed. When true, the underlyingError property will contain the associated value.

var isRequestRetryError:​ Bool

isCreateUploadableError

Returns whether the instance is createUploadableFailed. When true, the underlyingError property will contain the associated value.

var isCreateUploadableError:​ Bool

isCreateURLRequestError

Returns whether the instance is createURLRequestFailed. When true, the underlyingError property will contain the associated value.

var isCreateURLRequestError:​ Bool

isDownloadedFileMoveError

Returns whether the instance is downloadedFileMoveFailed. When true, the destination and underlyingError properties will contain the associated values.

var isDownloadedFileMoveError:​ Bool

isSessionTaskError

Returns whether the instance is createURLRequestFailed. When true, the underlyingError property will contain the associated value.

var isSessionTaskError:​ Bool

urlConvertible

The URLConvertible associated with the error.

var urlConvertible:​ URLConvertible?

url

The URL associated with the error.

var url:​ URL?

underlyingError

The underlying Error responsible for generating the failure associated with .sessionInvalidated, .parameterEncodingFailed, .parameterEncoderFailed, .multipartEncodingFailed, .requestAdaptationFailed, .responseSerializationFailed, .requestRetryFailed errors.

var underlyingError:​ Error?

acceptableContentTypes

The acceptable Content-Types of a .responseValidationFailed error.

var acceptableContentTypes:[String]?

responseContentType

The response Content-Type of a .responseValidationFailed error.

var responseContentType:​ String?

responseCode

The response code of a .responseValidationFailed error.

var responseCode:​ Int?

failedStringEncoding

The String.Encoding associated with a failed .stringResponse() call.

var failedStringEncoding:​ String.Encoding?

sourceURL

The source URL of a .downloadedFileMoveFailed error.

var sourceURL:​ URL?

destinationURL

The destination URL of a .downloadedFileMoveFailed error.

var destinationURL:​ URL?

errorDescription

var errorDescription:​ String?
Types
Protocols
Global Typealiases
Clone this wiki locally