Update the description about this error code, and fix one potential issue of callback
This commit is contained in:
parent
c228eb5bdc
commit
7057e70cd5
|
@ -128,6 +128,8 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
|
|||
@synchronized (self) {
|
||||
if (self.isCancelled) {
|
||||
self.finished = YES;
|
||||
// Operation cancelled by user before sending the request
|
||||
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorDownloadCancelled userInfo:nil]];
|
||||
[self reset];
|
||||
return;
|
||||
}
|
||||
|
@ -226,6 +228,7 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
|
|||
if (self.isExecuting) self.executing = NO;
|
||||
if (!self.isFinished) self.finished = YES;
|
||||
} else {
|
||||
// Operation cancelled by user before sending the request
|
||||
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorDownloadCancelled userInfo:nil]];
|
||||
}
|
||||
|
||||
|
|
|
@ -19,5 +19,5 @@ typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {
|
|||
SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached`
|
||||
SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized
|
||||
SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey`
|
||||
SDWebImageErrorDownloadCancelled = 2002, // The image download operation is cancelled by user.
|
||||
SDWebImageErrorDownloadCancelled = 2002, // The image download operation is cancelled by user before sending the request
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue