Kingfisher Documentation

Enumeration Kingfisher​Error

public enum KingfisherError: Error  

Represents all the errors which can happen in Kingfisher framework. Kingfisher related methods always throw a KingfisherError or invoke the callback with KingfisherError as its error type. To handle errors from Kingfisher, you switch over the error to get a reason catalog, then switch over the reason to know error detail.

%89 KingfisherError KingfisherError LocalizedError LocalizedError KingfisherError->LocalizedError CustomNSError CustomNSError KingfisherError->CustomNSError Error Error KingfisherError->Error

Nested Types

KingfisherError.RequestErrorReason

Represents the error reason during networking request phase.

KingfisherError.ResponseErrorReason

Represents the error reason during networking response phase.

KingfisherError.CacheErrorReason

Represents the error reason during Kingfisher caching system.

KingfisherError.ProcessorErrorReason

Represents the error reason during image processing phase.

KingfisherError.ImageSettingErrorReason

Represents the error reason during image setting in a view related class.

Conforms To

CustomNSError
Error
LocalizedError

Enumeration Cases

request​Error

case requestError(reason: RequestErrorReason) 

Represents the error reason during networking request phase.

response​Error

case responseError(reason: ResponseErrorReason) 

Represents the error reason during networking response phase.

cache​Error

case cacheError(reason: CacheErrorReason) 

Represents the error reason during Kingfisher caching system.

processor​Error

case processorError(reason: ProcessorErrorReason) 

Represents the error reason during image processing phase.

image​Setting​Error

case imageSettingError(reason: ImageSettingErrorReason) 

Represents the error reason during image setting in a view related class.

Properties

is​Task​Cancelled

public var isTaskCancelled: Bool  

Helper property to check whether this error is a RequestErrorReason.taskCancelled or not.

is​Invalid​Response​Status​Code

public var isInvalidResponseStatusCode: Bool  

is​Not​Current​Task

public var isNotCurrentTask: Bool  

Helper property to check whether this error is a ImageSettingErrorReason.notCurrentSourceTask or not. When a new image setting task starts while the old one is still running, the new task identifier will be set and the old one is overwritten. A .notCurrentSourceTask error will be raised when the old task finishes to let you know the setting process finishes with a certain result, but the image view or button is not set.

error​Description

public var errorDescription: String?  

A localized message describing what error occurred.

domain

public static let domain = "com.onevcat.Kingfisher.Error"

The error domain of KingfisherError. All errors from Kingfisher is under this domain.

error​Code

public var errorCode: Int  

The error code within the given domain.

Methods

is​Invalid​Response​Status​Code(_:​)

public func isInvalidResponseStatusCode(_ code: Int) -> Bool  

Helper method to check whether this error is a ResponseErrorReason.invalidHTTPStatusCode and the associated value is a given status code.

Parameters

code Int

The given status code.

Returns

If self is a ResponseErrorReason.invalidHTTPStatusCode error and its status code equals to code, true is returned. Otherwise, false.