From f6f52cbd5973841e24bce5f190df75b02114df1f Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 2 Oct 2019 12:01:12 +0300 Subject: Do not ignore POST errors --- Juick/APIClient.m | 14 +++++++++----- 1 file 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); } }]; } -- cgit v1.2.3