Merge pull request #1011 from mattjgalloway/error_domain
Make a constant for the error domain
This commit is contained in:
commit
0ef0e07f77
|
@ -62,7 +62,7 @@ static char imageURLKey;
|
|||
[self sd_setImageLoadOperation:operation forKey:@"MKAnnotationViewImage"];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
|
|||
|
||||
typedef void(^SDWebImageNoParamsBlock)();
|
||||
|
||||
extern NSString *const SDWebImageErrorDomain;
|
||||
|
||||
#define dispatch_main_sync_safe(block)\
|
||||
if ([NSThread isMainThread]) {\
|
||||
block();\
|
||||
|
|
|
@ -43,3 +43,5 @@ inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) {
|
|||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain";
|
||||
|
|
|
@ -376,7 +376,7 @@
|
|||
}
|
||||
}
|
||||
if (CGSizeEqualToSize(image.size, CGSizeZero)) {
|
||||
completionBlock(nil, nil, [NSError errorWithDomain:@"SDWebImageErrorDomain" code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
||||
completionBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image has 0 pixels"}], YES);
|
||||
}
|
||||
else {
|
||||
completionBlock(image, self.imageData, nil, YES);
|
||||
|
|
|
@ -57,7 +57,7 @@ static char imageURLStorageKey;
|
|||
[self.imageURLStorage removeObjectForKey:@(state)];
|
||||
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static char imageURLStorageKey;
|
|||
[self sd_setBackgroundImageLoadOperation:operation forState:state];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
[self sd_setImageLoadOperation:operation forKey:UIImageViewHighlightedWebCacheOperationKey];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ static char imageURLKey;
|
|||
[self sd_setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"];
|
||||
} else {
|
||||
dispatch_main_async_safe(^{
|
||||
NSError *error = [NSError errorWithDomain:@"SDWebImageErrorDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
|
||||
if (completedBlock) {
|
||||
completedBlock(nil, error, SDImageCacheTypeNone, url);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue