Simplify dispatchFailureBlock
As error is overridden to always return the custom error object we can omit the extra error: parameter in dispatchFailureBlock, making the code even simpler.
This commit is contained in:
parent
30a5cea4fc
commit
800d05181d
6 changed files with 9 additions and 10 deletions
|
|
@ -119,6 +119,6 @@
|
|||
/**
|
||||
Executes the failureBlock on the corresponding failureCallbackQueue.
|
||||
*/
|
||||
- (void)dispatchFailureBlock:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureBlock error:(NSError *)error;
|
||||
- (void)dispatchFailureBlock:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureBlock;
|
||||
|
||||
@end
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
}
|
||||
|
||||
if (self.error) {
|
||||
[self dispatchFailureBlock:failure error:self.error];
|
||||
[self dispatchFailureBlock:failure];
|
||||
} else {
|
||||
[self dispatchSuccessBlock:success responseObject:self.responseString];
|
||||
}
|
||||
|
|
@ -150,12 +150,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)dispatchFailureBlock:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureBlock error:(NSError *)error {
|
||||
- (void)dispatchFailureBlock:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failureBlock {
|
||||
if (failureBlock) {
|
||||
dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{
|
||||
failureBlock(self, error);
|
||||
failureBlock(self, self.error);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
|||
|
||||
dispatch_async(image_request_operation_processing_queue(), ^(void) {
|
||||
if (self.error) {
|
||||
[self dispatchFailureBlock:failure error:self.error];
|
||||
[self dispatchFailureBlock:failure];
|
||||
} else {
|
||||
[self dispatchSuccessBlock:success responseObject:self.responseImage];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ static dispatch_queue_t json_request_operation_processing_queue() {
|
|||
id JSON = self.responseJSON;
|
||||
|
||||
if (self.JSONError) {
|
||||
[self dispatchFailureBlock:failure error:self.JSONError];
|
||||
[self dispatchFailureBlock:failure];
|
||||
} else {
|
||||
[self dispatchSuccessBlock:success responseObject:JSON];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,13 +124,13 @@ static dispatch_queue_t property_list_request_operation_processing_queue() {
|
|||
}
|
||||
|
||||
if (self.error) {
|
||||
[self dispatchFailureBlock:failure error:self.error];
|
||||
[self dispatchFailureBlock:failure];
|
||||
} else {
|
||||
dispatch_async(property_list_request_operation_processing_queue(), ^(void) {
|
||||
id propertyList = self.responsePropertyList;
|
||||
|
||||
if (self.propertyListError) {
|
||||
[self dispatchFailureBlock:failure error:self.propertyListError];
|
||||
[self dispatchFailureBlock:failure];
|
||||
}else {
|
||||
[self dispatchSuccessBlock:success responseObject:propertyList];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() {
|
|||
}
|
||||
|
||||
if (self.error) {
|
||||
[self dispatchFailureBlock:failure error:self.error];
|
||||
[self dispatchFailureBlock:failure];
|
||||
} else {
|
||||
[self dispatchSuccessBlock:success responseObject:self.responseXMLParser];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue