diff options
author | Vitaly Takmazov | 2019-10-02 12:01:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-10-02 12:01:12 +0300 |
commit | f6f52cbd5973841e24bce5f190df75b02114df1f (patch) | |
tree | e46b4aa99432e6c2fb473d3a68292af14a07455a | |
parent | 4272a59934b65f5b0b4108b08b8d069a33d67676 (diff) |
Do not ignore POST errors
-rw-r--r-- | Juick/APIClient.m | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 3332556..4652c0c 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -253,12 +253,16 @@ NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL]; NSString *boundary = [NSString stringWithFormat:@"Boundary-%@", [[NSUUID UUID] UUIDString]]; [self fetchDataWithURL:url data:[self multipartData:params withBoundary:boundary] boundary:boundary callback:^(NSData *data, NSError *err) { - NSError *jsonError; - NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError]; - if (jsonError) { - callback(nil, jsonError); + if (!err) { + NSError *jsonError; + NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError]; + if (jsonError) { + callback(nil, jsonError); + } else { + callback(jsonData, nil); + } } else { - callback(jsonData, nil); + callback(nil, err); } }]; } |