docs/Enums/AFError.html
public enum AFError : Error, Sendable
extension AFError: LocalizedError
AFError is the error type returned by Alamofire. It encompasses a few different types of errors, each with their own associated reasons.
`
MultipartEncodingFailureReason
`
The underlying reason the .multipartEncodingFailed error occurred.
Swift
public enum MultipartEncodingFailureReason : Sendable
`
UnexpectedInputStreamLength
`
Represents unexpected input stream length that occur when encoding the MultipartFormData. Instances will be embedded within an AFError.multipartEncodingFailed .inputStreamReadFailed case.
Swift
public struct UnexpectedInputStreamLength : Error
`
ParameterEncodingFailureReason
`
The underlying reason the .parameterEncodingFailed error occurred.
Swift
public enum ParameterEncodingFailureReason : Sendable
`
ParameterEncoderFailureReason
`
The underlying reason the .parameterEncoderFailed error occurred.
Swift
public enum ParameterEncoderFailureReason : Sendable
`
ResponseValidationFailureReason
`
The underlying reason the .responseValidationFailed error occurred.
Swift
public enum ResponseValidationFailureReason : Sendable
`
ResponseSerializationFailureReason
`
The underlying reason the response serialization error occurred.
Swift
public enum ResponseSerializationFailureReason : Sendable
`
ServerTrustFailureReason
`
Underlying reason a server trust evaluation error occurred.
Swift
public enum ServerTrustFailureReason : Sendable
`
URLRequestValidationFailureReason
`
The underlying reason the .urlRequestValidationFailed error occurred.
Swift
public enum URLRequestValidationFailureReason : Sendable
`
createUploadableFailed(error:)
`
UploadableConvertible threw an error in createUploadable().
Swift
case createUploadableFailed(error: any Error)
`
createURLRequestFailed(error:)
`
URLRequestConvertible threw an error in asURLRequest().
Swift
case createURLRequestFailed(error: any Error)
`
downloadedFileMoveFailed(error:source:destination:)
`
SessionDelegate threw an error while attempting to move downloaded file to destination URL.
Swift
case downloadedFileMoveFailed(error: any Error, source: URL, destination: URL)
`
explicitlyCancelled
`
Request was explicitly cancelled.
Swift
case explicitlyCancelled
`
invalidURL(url:)
`
URLConvertible type failed to create a valid URL.
Swift
case invalidURL(url: any URLConvertible)
`
multipartEncodingFailed(reason:)
`
Multipart form encoding failed.
Swift
case multipartEncodingFailed(reason: MultipartEncodingFailureReason)
`
parameterEncodingFailed(reason:)
`
ParameterEncoding threw an error during the encoding process.
Swift
case parameterEncodingFailed(reason: ParameterEncodingFailureReason)
`
parameterEncoderFailed(reason:)
`
ParameterEncoder threw an error while running the encoder.
Swift
case parameterEncoderFailed(reason: ParameterEncoderFailureReason)
`
requestAdaptationFailed(error:)
`
RequestAdapter threw an error during adaptation.
Swift
case requestAdaptationFailed(error: any Error)
`
requestRetryFailed(retryError:originalError:)
`
RequestRetrier threw an error during the request retry process.
Swift
case requestRetryFailed(retryError: any Error, originalError: any Error)
`
responseValidationFailed(reason:)
`
Response validation failed.
Swift
case responseValidationFailed(reason: ResponseValidationFailureReason)
`
responseSerializationFailed(reason:)
`
Response serialization failed.
Swift
case responseSerializationFailed(reason: ResponseSerializationFailureReason)
`
serverTrustEvaluationFailed(reason:)
`
ServerTrustEvaluating instance threw an error during trust evaluation.
Swift
case serverTrustEvaluationFailed(reason: ServerTrustFailureReason)
`
sessionDeinitialized
`
Session which issued the Request was deinitialized, most likely because its reference went out of scope.
Swift
case sessionDeinitialized
`
sessionInvalidated(error:)
`
Session was explicitly invalidated, possibly with the Error produced by the underlying URLSession.
Swift
case sessionInvalidated(error: (any Error)?)
`
sessionTaskFailed(error:)
`
URLSessionTask completed with error.
Swift
case sessionTaskFailed(error: any Error)
`
urlRequestValidationFailed(reason:)
`
URLRequest failed validation.
Swift
case urlRequestValidationFailed(reason: URLRequestValidationFailureReason)
`
isSessionDeinitializedError
`
Returns whether the instance is .sessionDeinitialized.
Swift
public var isSessionDeinitializedError: Bool { get }
`
isSessionInvalidatedError
`
Returns whether the instance is .sessionInvalidated.
Swift
public var isSessionInvalidatedError: Bool { get }
`
isExplicitlyCancelledError
`
Returns whether the instance is .explicitlyCancelled.
Swift
public var isExplicitlyCancelledError: Bool { get }
`
isInvalidURLError
`
Returns whether the instance is .invalidURL.
Swift
public var isInvalidURLError: Bool { get }
`
isParameterEncodingError
`
Returns whether the instance is .parameterEncodingFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isParameterEncodingError: Bool { get }
`
isParameterEncoderError
`
Returns whether the instance is .parameterEncoderFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isParameterEncoderError: Bool { get }
`
isMultipartEncodingError
`
Returns whether the instance is .multipartEncodingFailed. When true, the url and underlyingError properties will contain the associated values.
Swift
public var isMultipartEncodingError: Bool { get }
`
isRequestAdaptationError
`
Returns whether the instance is .requestAdaptationFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isRequestAdaptationError: Bool { get }
`
isResponseValidationError
`
Returns whether the instance is .responseValidationFailed. When true, the acceptableContentTypes, responseContentType, responseCode, and underlyingError properties will contain the associated values.
Swift
public var isResponseValidationError: Bool { get }
`
isResponseSerializationError
`
Returns whether the instance is .responseSerializationFailed. When true, the failedStringEncoding and underlyingError properties will contain the associated values.
Swift
public var isResponseSerializationError: Bool { get }
`
isServerTrustEvaluationError
`
Returns whether the instance is .serverTrustEvaluationFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isServerTrustEvaluationError: Bool { get }
`
isRequestRetryError
`
Returns whether the instance is requestRetryFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isRequestRetryError: Bool { get }
`
isCreateUploadableError
`
Returns whether the instance is createUploadableFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isCreateUploadableError: Bool { get }
`
isCreateURLRequestError
`
Returns whether the instance is createURLRequestFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isCreateURLRequestError: Bool { get }
`
isDownloadedFileMoveError
`
Returns whether the instance is downloadedFileMoveFailed. When true, the destination and underlyingError properties will contain the associated values.
Swift
public var isDownloadedFileMoveError: Bool { get }
`
isSessionTaskError
`
Returns whether the instance is createURLRequestFailed. When true, the underlyingError property will contain the associated value.
Swift
public var isSessionTaskError: Bool { get }
`
urlConvertible
`
The URLConvertible associated with the error.
Swift
public var urlConvertible: (any URLConvertible)? { get }
`
url
`
The URL associated with the error.
Swift
public var url: URL? { get }
`
underlyingError
`
The underlying Error responsible for generating the failure associated with .sessionInvalidated, .parameterEncodingFailed, .parameterEncoderFailed, .multipartEncodingFailed, .requestAdaptationFailed, .responseSerializationFailed, .requestRetryFailed errors.
Swift
public var underlyingError: (any Error)? { get }
`
acceptableContentTypes
`
The acceptable Content-Types of a .responseValidationFailed error.
Swift
public var acceptableContentTypes: [String]? { get }
`
responseContentType
`
The response Content-Type of a .responseValidationFailed error.
Swift
public var responseContentType: String? { get }
`
responseCode
`
The response code of a .responseValidationFailed error.
Swift
public var responseCode: Int? { get }
`
failedStringEncoding
`
The String.Encoding associated with a failed .stringResponse() call.
Swift
public var failedStringEncoding: String.Encoding? { get }
`
sourceURL
`
The source URL of a .downloadedFileMoveFailed error.
Swift
public var sourceURL: URL? { get }
`
destinationURL
`
The destination URL of a .downloadedFileMoveFailed error.
Swift
public var destinationURL: URL? { get }
`
downloadResumeData
`
The download resume data of any underlying network error. Only produced by DownloadRequests.
Swift
public var downloadResumeData: Data? { get }
`
errorDescription
`
Swift
public var errorDescription: String? { get }