Commit ea7bfafd by Dima Bart

Remove redundant responseCode check in unnecessary method.

parent dc2579cb
......@@ -169,8 +169,8 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
if (!error) {
error = [self errorFromJSON:json response:httpResponse];
if (!error && !httpResponse.successful) {
error = [[NSError alloc] initWithDomain:BUYShopifyErrorDomain code:httpResponse.statusCode userInfo:json];
}
completion(json, httpResponse, error);
......@@ -178,14 +178,4 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
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
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