Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit afebde8

Browse filesBrowse files
committed
if there was a network error, don't mask it behind a bad response error
1 parent c3eebd8 commit afebde8
Copy full SHA for afebde8

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Collapse file

‎JSONModel/JSONModelNetworking/JSONHTTPClient.m‎

Copy file name to clipboardExpand all lines: JSONModel/JSONModelNetworking/JSONHTTPClient.m
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,16 @@ +(void)JSONFromURLWithString:(NSString*)urlString method:(NSString*)method param
271271
params: params
272272
error: &error];
273273
}
274-
275-
jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
276274
}
277275
@catch (NSException *exception) {
278276
error = [JSONModelError errorBadResponse];
279277
}
280278

279+
if (error==nil) {
280+
//data fetched successfuly from the net
281+
jsonObject = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
282+
}
283+
281284
dispatch_async(dispatch_get_main_queue(), ^{
282285
if (completeBlock) {
283286
completeBlock(jsonObject, error);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.