Commit ea7bfafd by Dima Bart

Remove redundant responseCode check in unnecessary method.

parent dc2579cb
...@@ -169,8 +169,8 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse * ...@@ -169,8 +169,8 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
} }
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if (!error) { if (!error && !httpResponse.successful) {
error = [self errorFromJSON:json response:httpResponse]; error = [[NSError alloc] initWithDomain:BUYShopifyErrorDomain code:httpResponse.statusCode userInfo:json];
} }
completion(json, httpResponse, error); completion(json, httpResponse, error);
...@@ -178,14 +178,4 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse * ...@@ -178,14 +178,4 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
return task; return task;
} }
#pragma mark - Error -
- (NSError *)errorFromJSON:(NSDictionary *)json response:(NSHTTPURLResponse *)response
{
if ((int)(response.statusCode / 100.0) != 2) { // If not a 2xx response code
return [[NSError alloc] initWithDomain:BUYShopifyErrorDomain code:response.statusCode userInfo:json];
}
return nil;
}
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment