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:
Peter Steinberger 2012-02-08 15:04:29 -08:00
parent 30a5cea4fc
commit 800d05181d
6 changed files with 9 additions and 10 deletions

View file

@ -119,6 +119,6 @@
/** /**
Executes the failureBlock on the corresponding failureCallbackQueue. 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 @end

View file

@ -127,7 +127,7 @@
} }
if (self.error) { if (self.error) {
[self dispatchFailureBlock:failure error:self.error]; [self dispatchFailureBlock:failure];
} else { } else {
[self dispatchSuccessBlock:success responseObject:self.responseString]; [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) { if (failureBlock) {
dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{
failureBlock(self, error); failureBlock(self, self.error);
}); });
} }
} }

View file

@ -230,7 +230,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
dispatch_async(image_request_operation_processing_queue(), ^(void) { dispatch_async(image_request_operation_processing_queue(), ^(void) {
if (self.error) { if (self.error) {
[self dispatchFailureBlock:failure error:self.error]; [self dispatchFailureBlock:failure];
} else { } else {
[self dispatchSuccessBlock:success responseObject:self.responseImage]; [self dispatchSuccessBlock:success responseObject:self.responseImage];
} }

View file

@ -134,7 +134,7 @@ static dispatch_queue_t json_request_operation_processing_queue() {
id JSON = self.responseJSON; id JSON = self.responseJSON;
if (self.JSONError) { if (self.JSONError) {
[self dispatchFailureBlock:failure error:self.JSONError]; [self dispatchFailureBlock:failure];
} else { } else {
[self dispatchSuccessBlock:success responseObject:JSON]; [self dispatchSuccessBlock:success responseObject:JSON];
} }

View file

@ -124,13 +124,13 @@ static dispatch_queue_t property_list_request_operation_processing_queue() {
} }
if (self.error) { if (self.error) {
[self dispatchFailureBlock:failure error:self.error]; [self dispatchFailureBlock:failure];
} else { } else {
dispatch_async(property_list_request_operation_processing_queue(), ^(void) { dispatch_async(property_list_request_operation_processing_queue(), ^(void) {
id propertyList = self.responsePropertyList; id propertyList = self.responsePropertyList;
if (self.propertyListError) { if (self.propertyListError) {
[self dispatchFailureBlock:failure error:self.propertyListError]; [self dispatchFailureBlock:failure];
}else { }else {
[self dispatchSuccessBlock:success responseObject:propertyList]; [self dispatchSuccessBlock:success responseObject:propertyList];
} }

View file

@ -187,7 +187,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() {
} }
if (self.error) { if (self.error) {
[self dispatchFailureBlock:failure error:self.error]; [self dispatchFailureBlock:failure];
} else { } else {
[self dispatchSuccessBlock:success responseObject:self.responseXMLParser]; [self dispatchSuccessBlock:success responseObject:self.responseXMLParser];
} }